How to get gcc -O1 optimization without specifying -O1 [duplicate]
I know that -O1 automatically turns on certain flags. These flags can be turned on manually though. If I don't specify -O1, it should still be possible to get -O1 optimization by specifying all the...
View ArticleVisual C++ dump preprocessor defines
I'm trying to find out all the preprocessor defines of the Visual C++ compiler (MSVC). I can dogcc -dM -E - < /dev/nullon GCC to dump all the preprocessor defines. Do we have something similar with...
View Articlegcc - 2 versions, different treatment of inline functions
Recently I've come across a problem in my project. I normally compile it in gcc-4, but after trying to compile in gcc-3, I noticed a different treatment of inline functions. To illustrate this I've...
View ArticleProblem to compile a C-program by GCC in the latest Cygwin due to tgmath.h...
I have successfully compiled a C-program with GCC in Mac OS X and Linux, but have got the following error message in Cygwin 1.7.5:/usr/lib/gcc/i686-pc-cygwin/4.3.4/include/tgmath.h:38:21: error:...
View ArticleLink to libraries built by GCC when I use ICC for my code
For a personal project on Linux, I would like to use ICC. My project uses Boost, Qt and several other libraries. These libraries are available on Ubuntu repository so I would like to save time by...
View ArticleIs it possible to turn off support for "and" / "or" boolean operator usage in...
GCC seems to allow "and" / "or" to be used instead of "&&" / "||" in C++ code; however, as I expected, many compilers (notably MSVC 7) do not support this. The fact that GCC allows this has...
View ArticleWhich gcc is being used on Ubuntu 10.10
I installed the latest version of gcc on my linux-x86 from the command line. The /usr/bin/ shows two gccs, namely gcc and gcc-4.4. After browsing a few sites, I navigated to my...
View Article-std=c++11 flag unrecognized in gcc/g++ 4.4.6
I have some code written using the C++11 standards, and our g++ version is 4.4.6, so as far as I can tell, C++11 should be supported (from 4.3 onwards).However upon trying to compile with the flags...
View Articlegcc-8 -Wstringop-truncation what is the good practice?
GCC 8 added a -Wstringop-truncation warning. From https://gcc.gnu.org/bugzilla/show_bug.cgi?id=82944 :The -Wstringop-truncation warning added in GCC 8.0 via r254630 for bug 81117 is specifically...
View ArticleCompiling for both Intel and PPC CPUs on OSX
I have a MacBook Pro with a 64-bit Intel Core 2 Duo processor, and I'm using gcc (i686-apple-darwin9-gcc-4.0.1) to compile executables which I can run ok on my own machine. Recently someone tried to...
View ArticleWhy gcc is so much worse at std::vector vectorization of a conditional...
Consider following float loop, compiled using -O3 -mavx2 -mfmafor (auto i = 0; i < a.size(); ++i) { a[i] = (b[i] > c[i]) ? (b[i] * c[i]) : 0;}Clang done perfect job at vectorizing it. It uses...
View ArticleMultiple definitions of glibc symbols when linking several static libraries...
So I have made two libraries with gcc and ar: libwa.a and libws.a.When I link them using -l flag in my project. I get this error:/usr/bin/ld: .../lib/libws.a(bhns.c.o): in function...
View ArticleHow to perform cross-platform testing for a C++ program [closed]
I am working on a project which uses Python, Javascript, but more importantly C/C++. We are hoping to distribute this project as both shared libraries to hide parts of the implementation and source...
View ArticleError with libnftnl on Ubuntu 20.04. /usr/bin/ld: cannot find -lnftnl
I try to build a C program that uses the libnftnl library, but I get this error:/usr/bin/ld: cannot find -lnftnlHere is the way that I compile my code:LIBS = -L/usr/lib/x86_64-linux-gnu/libmnl.so...
View ArticleHow to check if gcc is installed on my pc
How do I check if gcc is installed on my pc? I'm running windows 7.
View ArticleHow to create a executable hex from elf file format
I am very very new to this, I have elf file input.out and need to create hex executable from it. I am using objcopy to create executable in intel hex format as followsobjcopy -O ihex input.out...
View ArticleWhat versions of C allow you to declare variables in for loops?
Ever since I began coding in C, I was taught thatfor(int i=0;i<10;++i)...worked in C++, but in C you must declare the variable outside of the for loop like so:int i;for(i=0;i<10;++i)...I...
View ArticleWhy are these C functions optimized differently by GCC?
I am writing embedded code for an ARM Cortex-M processor. I wanted some generic function to copy memory to registers that are mapped contiguously into memory.Since the C standard forbids aliasing...
View ArticleWhat is the use of matching constraints in inline assembly
From the following link, https://www.ibm.com/developerworks/library/l-ia/index.htmla single variable may serve as both the input and the output operand.I wrote the following code:#include...
View ArticleBuildroot with support for float128 on SAMA5D2 (Cortex-A5)
I'm trying to port an aplication that uses float128 (previously running on an arm64) to a board with SAMA5D2 (Cortex-A5) but can't seem to find a way to enable support for float 128.After looking...
View Article