Questions tagged [gcc]
GCC is the GNU Compiler Collection. It's the de facto standard compiler for C, C++, Go, Fortran, and Ada on Linux and supports many other languages and platforms as well.
41,803
questions
0
votes
0
answers
33
views
How can I declare a pointer to a constant struct literal that uses a flexible array in C if possible? [duplicate]
So I wanted to store some constant text and data for parts of a level in a game in a struct, then put pointers for all those structs in a struct for each level, and pointers for all the level structs ...
0
votes
0
answers
52
views
Meaning of rust-gdb.exe, rust-gdbgui.exe with respect to gnu gdb?
I am working on Rust and I am debugging with gdb (MinGW64, I am working on msw).
I saw in the .cargo folder (.cargo/bin) many executables:
Directory of C:\Users\me\.cargo\bin
24/06/2024 19:37 &...
0
votes
0
answers
24
views
Using GCC on Apple M2 Max Laptop
I can't use GCC because clang interferes with it. I used brew install gcc, and it downloaded correctly but I can't use it because clang overrides it. I added the path into my /.bash_profile so when I ...
-1
votes
0
answers
46
views
visual studio code dosen't recognize ''./a.out''? [duplicate]
I wrote a c++ code on visual studio code. Later I tried to run it on terminal. When I wrote ./a.out, it didn't recognize. It shows
./a.out : The term './a.out' is not recognized as the name of a ...
4
votes
2
answers
97
views
C++ ambiguous member vs non-member function template resolution in GCC 14 but not in prior GCC versions
The following code compiles fine with GCC 13 and earlier, but GCC 14.1 produces an "ambiguous overload" error. Is it a compiler or code problem, and, more pragmatically, can I make the ...
-1
votes
1
answer
64
views
how to debug "*** buffer overflow detected ***: program_name terminated" along with _FORTIFY_SOURCE=2
My program crashes with the message "*** buffer overflow detected ***: program_name terminated", and I suspect it may be related to the compiler option "_FORTIFY_SOURCE=2" that I ...
0
votes
0
answers
62
views
tsan thread sanitizer, why only a single bug is reported
I wrote a simple test prog which contains two data races. But tsan only reports the first one what ever I try to modify.
Is tsan always only reporting a single bug? Maybe tsan can't see some bugs ...
0
votes
0
answers
19
views
gdb and thread sanitizer gcc, how to stop on warning/error
I tried to run a program compiled with thread sanitizer under gdb control. I simply want to stop if an warning/error occurs.
From How to add breakpoint when thread sanitizer reports data-race? I found
...
1
vote
1
answer
64
views
RVV type for a class member in C++
I would like to use RISC-V vector extension in my C++ application.
I noticed that it is not possible to use RVV types (e.g., "vuint32m1_t") for class members. Compiling with gcc (v13.2.0), I ...
1
vote
0
answers
67
views
Assembling with gcc gives error operand type mismatch for `cmp' for some integers, not others
This is a weird one. I'm using gcc to assemble a program and I want to know if the value in register rsi fits in 32 bits, so I use this instruction:
cmpq $0xffffffff, %rsi
I get back an error that ...
1
vote
1
answer
128
views
is implementation allowed to reserve arbitrary names in global scope?
I've been porting a windows library to linux and it's failing on declaration of struct error_t. Both gcc and clang are giving an error message:
/usr/include/x86_64-linux-gnu/bits/types/error_t.h:22:...
-1
votes
0
answers
21
views
Why is GCC not used as Shader Compiler in Mesa? [closed]
Mesa GPU driver currently employs LLVM by default or Valve's ACO as a shader compiler. Why doesn't Mesa use GCC as default for shader compilation like GCC is default for building Linux/BSD?
Mesa is ...
0
votes
1
answer
95
views
Virtual memory size increases considerably with thread count
In the below C++ code example, each time the user presses the Enter key, a new thread will be created. The thread waits for 10 minutes and then exits. The thread has a std::string object with some ...
0
votes
0
answers
52
views
Linux: GCC 9.3: linking against a dynamic library compiled with GCC 4.8
So, I have a proprietary library (not open source) that was compiled with Devtoolset-3 (GCC 4.8). Currently, Devtoolset-3 is marked as EOL (end-of-life) for the target distro (CentOS 7). So, ...
0
votes
1
answer
41
views
Unexpected output of C++11 regex?
#include <iostream>
#include <regex>
#include <string>
#include <vector>
using namespace std;
#define debug(exp) do { cout << #exp << ": " << (exp) &...