strcmp triggering warning: '' may be used uninitialized [-Wmaybe-uninitialized]?
I am trying to build https://github.com/TheCodeArtist/elf-parser under MINGW64 (MSYS2) bash shell in Windows 10.I have made some patches so far, which are saved as /tmp/elf-parser-mingw.patch:diff...
View ArticleWhat is the purpose of the instructions that gcc emits?
I have an example of C code with an issue (integer promotions from uint16_t to int, and then cast to uint32_t):#include <stdio.h>#include <stdint.h>int main() { uint16_t x = 48000; uint32_t...
View ArticleOptimizations removing template variable whose type determines which...
I have a function template that can call multiple versions of an overloaded function depending on the type. It looks something like this:template<typename T>void doSomething(T **inputT){ // do...
View ArticleUncertainty of GCC __restrict__ rules
I am uncertain if passing a __restrict__ pointer to another function is always breaking the rules of restrict aliasing (assuming that other function reads or writes to it) or if it is more subtleI am...
View ArticleConcept does not resolve ambiguity as expected. What's wrong with the code...
I experiment with c++ concepts. Tried to disambiguate a template 'using' clause by using a concept. Here is a simplified sample:#include <concepts>namespace A {template <typename T>class...
View Articlegcc throws compiler errors on every line of ARMv8 assembly function
I am trying to compile the following function:#include <stdio.h>extern long long int f(int a, int b);int main() { long long int x = f(3, 2); printf("Value of x = %lld\n", x); return 0;}function...
View ArticleIs it possible to compile programs that use ATL using GCC (MinGW or...
I'm confused how people use MinGW to compile Windows programs.I tried using it, but headers like atlalloc.h and atlcom.h use __try in a few ways... which no version of GCC appears to support, for...
View ArticleFunction written in assembly misbehaves only when inlined [duplicate]
I'm learning how C and assembly work together in GCC. Consider this program:#ifdef INLINE #define MAYBE_INLINE static inline#else #define MAYBE_INLINE#endif__attribute__((noreturn)) void...
View ArticleHow to suppress warnings for file included from header
I use GCC -Weffc++ option in my Qt project. To suppress warnings from Qt headers i add QMAKE_CXXFLAGS += -isystem $(QTDIR)\include.But this doesn't suppress all warnings, i still get annoying warnings...
View ArticleComparing double with literal value in C gives different results on 32 bit...
Can someone please explain why:double d = 1.0e+300;printf("%d\n", d == 1.0e+300);Prints "1" as expected on a 64-bit machine, but "0" on a 32-bit machine? (I got this using GCC 6.3 on Fedora 25)To my...
View Articleconfigure: error: C++ compiler cannot create executables when installing R...
I wanted to install stringi and RcppDist package at first.install.packages("stringi")But I get some problems with C++ compiler, it doesn't work properly although I've searched for almost every...
View ArticleHow to fix gcc -Wall "embedded '\0' in format" warning
This may not be very crucial, however I am trying to fix all the warnings g++ is complaining about. In the code below, I am getting "embedded '\0' in format" warning for the snprintf() line.How can I...
View Articleadding include directories causes the compiler to find syntax errors inside...
I've been trying to compile a program that simply prints out "hello world" with the cfg80211.h kernel header, as it is a header that I will be using for another project, so I at least want to know that...
View Articlewhy does -D_FORTIFY_SOURCE=2 has no effect in my compilation?
I have been adding some "compilation flags" to activate security measures in my binary. And then I check that the measures are implemented using the checksec tool. I have been able to activate all of...
View Articlepqxx/pqxx: No such file or directory gcc in VS Code, I use vcpkg
I did everything according to the vcpkg documentation from the website:https://learn.microsoft.com/en-us/vcpkg/get_started/get-started-vscode?pivots=shell-cmdAdded to the VCPKG_ROOT environment...
View ArticleCheck gcc minor in cmake
Is it possible to check the minor version number of GCC in cmake?I want to do something like this:If (GCC_MAJOR >= 4 && GCC_MINOR >= 3)
View ArticleInvalid optimization for pointer comparison in GCC? (introduced in GCC 7.1)
I have a puzzling problem regarding optimization and pointer equality that seems to happen only in GCC from version 7.1 and higher until the latest GCC version.The Problem can be shown with one simple...
View ArticleCompile error with homebrew gcc : unknown type name 'FILE' when including on...
After my recent macOS update (ARM to SDK 15.2) my C code—which previously compiled using Homebrew’s GCC—is now failing to compile. Simply including <stdio.h> produces the following...
View ArticleProfile-Guided-Optimizations by GCC - Profile File Analysis
I am working with Profile-Guided Optimizations (PGO) with GCC, using -fprofile-generate to collect execution data and -fprofile-use to optimize your executable based on the collected profile (.gcda...
View ArticleDetermining target from gcc plugin
How can I determine which target architecture we are building for from gcc plugin?I was thinking about using TARGET_CPU_CPP_BUILTINS, but the functions it expands to, e.g. ix86_target_macros, are not...
View Article