GCC reordering up across load with `memory_order_seq_cst`. Is this allowed?
Using a simplified version of a basic seqlock , gcc reorders a nonatomic load up across an atomic load(memory_order_seq_cst) when compiling the code with -O3. This reordering isn't observed when...
View ArticleGCC: Update from 4.9 to 8.x causes error: 'min' was not declared in this scope
I updated from Debian Jessie to Buster and now the shared code libraries (shared across Windows, Linux, etc..) build are broken in Linux (the library is over 20 years old, why break it).The module it...
View Articleld: cannot find -lnftnl on ubuntu
I am having issues compiling with libnftnl. I installed both libnftnl11 and libnftnl-dev on ubuntu, but the linker says: /usr/bin/ld: cannot find -lnftnl. Is there anything I am missing?I compiled...
View ArticleIs there a way to install and use gcc on MacBook M1?
I am trying to install and work with gcc compiler on my MacBook M1. I have installed gcc using home-brew, but I did not find a way to use it on the terminal in my Mac. I wanted to download a tool that...
View ArticleHow to Manually Link .o files in C (x86, 64 bit architecture)
I'm trying to accomplish what gcc is able to accomplish by running each command individually to better grasp what is happening when I compile my c programs. However, after following this chain of...
View ArticleIncomplete array type int (*p_arr)[ ]?
When I compiled the following code with gcc -Wall -pedantic -ansi -std=c89, it compiled successfully without giving an error at the pointer assignment. Note that I convert from int (*)[4] to int...
View ArticleWhy is cp-demangle.o is linked to my application
I'm trying to understand what would cause the linker to link cp-demangle.o to the application. The reason why I'm interested in this question is that this particular object file is taking 23.8kb code...
View ArticleLinux: Compile using a specific ncurses version when both V6 and V5 are...
In Linux, how can I choose which ncurses library to build against when both V5 and V6 are installed?Right now it defaults to V6 (the project is the same as when it was building to V5 before the upgrade...
View ArticleSqrt function makes 8kb place on flash memory of stm32
I'm developing stm32f030fp6 on stm32cubeIde but when I need to use sqrt, it takes about 8 kb in flash, I have this problem with sprintf function too, I searched more but there is no answer, is there...
View ArticleQuestion about std::make_pair & std::atomic_bool
Why this code snippet does not compile with gcc 4.9.0,whereas it works well with gcc 12.1.The same code snippet is compiled with the same option.Here is the code...
View ArticleHow to convert Intel Assembly C to AT&T C++
I trying to convert function "__cpuid" from С language to C++.I have a problem that the g++ compiler does not work with Intel assembler.I'm trying to translate this code:__asm { mov esi, CPUInfo mov...
View Articlecc1plus consumes too much CPU and memory
Is it normal to have cc1plus consuming too much CPU(60%) and memory(40%) when compiling? When i try to install opencv from source on my WSL(ubuntu18), i found cc1plus consuming too much CPU and memory...
View ArticleWhere does gcc look for C and C++ header files?
On a Unix system, where does gcc look for header files?I spent a little time this morning looking for some system header files, so I thought this would be good information to have here.
View ArticleHow does my self-built gcc 12 know to include gcc 12 c++ header files,...
I have a Ubuntu 20.04.2 LTS machine and have gcc 9.4.0 by default.I built a GCC-12.1.0 from source and wrote a very simple cpp program and compiled it with /path_to_gcc12_bin/g++.Then I run gdb to...
View ArticleGCC v12.1 warning about serial compilation
I have upgraded my whole arch linux system today (12th May, 2022). gcc was also upgraded from v11.2 to v12.1. I tried compiling some of my programs with g++ (part of gcc compiler collection) by the...
View ArticleStack address size on 80486, using gcc
GCC manual says that -m32"generates code that runs on any i386 system". Assume I want to write a function that swaps the bytes of a 32 bit number: .text .globl SwapBytes .type SwapBytes,...
View Articlefatal error: Python.h: No such file or directory
I am trying to build a shared library using a C extension file but first I have to generate the output file using the command below:gcc -Wall utilsmodule.c -o UtilcAfter executing the command, I get...
View Article-fsanitize=address ,-static-libasan, could not see asan libray linked to...
As mentioned using -fsanitize=address during compilation or .so file creation will automatically link libasan.so library right ?I am facing issue :-==13640==ASan runtime does not come first in initial...
View Article`restrict` ignored unless function manually inlined
With GCC 9.4.0, the codestatic inline double k(double const *restrict a) { return a[-1] + a[0] + a[1];}static void f(double const *restrict a, double *restrict b, int n) { for (int i = 0; i < n;...
View ArticleError in my QPSO code. Static type is not assignable
So while writing the qpso code, i came across this error. Kindly someone tell me how to fix this.In file included from c:\mingw\lib\gcc\mingw32\6.3.0\include\c++\bits\char_traits.h:39:0, from...
View Article