Tag: gcc

60 votes
3 answers
2.7K views
Possible GCC bug when returning struct from a function

I believe I found a bug in GCC while implementing O'Neill's PCG PRNG. (Initial code on Godbolt'

avatar
Vi
0 1 0 9
asked 07 September, 2021
65 votes
3 answers
3K views
How do you use gcc to generate assembly code in Intel syntax?

The gcc -S option will generate assembly code in AT&T syntax, is there a way to generate files in Intel sy

avatar
Brianne
0 1 0 9
asked 07 September, 2021
50 votes
3 answers
1.8K views
Why does GCC generate such radically different assembly for nearly the same C code?

While writing an optimized ftol function I found some very odd behaviour in GCC 4.6.1. Let me show you the cod

avatar
Eddie
0 1 0 9
asked 07 September, 2021
62 votes
5 answers
2.4K views
Why does GCC use multiplication by a strange number in implementing integer division?

I've been reading about div and mul assembly operations, and I decided to see them in action by writing a

avatar
Xavier
0 1 0 9
asked 07 September, 2021
48 votes
10 answers
1.6K views
Using GCC to produce readable assembly?

I was wondering how to use GCC on my C source file to dump a mnemonic version of the machine code so I could s

avatar
Jesenia
0 1 0 9
asked 07 September, 2021
55 votes
17 answers
1.5K views
How do you get assembler output from C/C++ source in gcc?

How does one do this? If I want to analyze how something is getting compiled, how would I get the emitted ass

avatar
Winford
0 1 0 9
asked 07 September, 2021
58 votes
12 answers
923 views
Why doesn't GCC optimize a*a*a*a*a*a to (a*a*a)*(a*a*a)?

I am doing some numerical optimization on a scientific application. One thing I noticed is that GCC will optim

avatar
Venice
0 1 0 9
asked 07 September, 2021
62 votes
5 answers
1.3K views
Why does the C preprocessor interpret the word "linux" as the constant "1"?

Why does the C preprocessor in GCC interpret the word linux (small letters) as the constant 1? test.c: #incl

avatar
Kurtis
0 1 0 9
asked 07 September, 2021
51 votes
1 answers
505 views
GCC: what's the default value when a symbol is defined on command line?

The following test code shows that a -DMY_FLAG on command line gives the symbol MY_FLAG a non-zero value, acco

avatar
Shanita
0 1 0 9
asked 07 September, 2021