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.

GCC is the GNU Compiler Collection, a collection of free software compilers. It is a key component of the GNU Toolchain.

GCC includes an optimizing C compiler that is the most commonly used C compiler on Linux. GCC also includes front ends for C++ (including full support for C++17), Objective-C, Fortran, Ada, and Go, as well as libraries for these languages (libstdc++, libgfortran, ...). It supports many architectures.

GCC sources are available via the Git repository. Major decisions about GCC are made by the steering committee, guided by the mission statement.

See also GCC online documentation and the home page, and release dates.

40905 questions
21
votes
2 answers

GCC NRVO/RVO warning

Is there any warning, which allows us to know whether NRVO/RVO performed or not, in GCC? I found that -fno-elide-constructors turns off NRVO/RVO, but NRVO/RVO has its own conditions to occur and sometimes does not occur. There is a need to know if…
Tomilov Anatoliy
  • 15,657
  • 10
  • 64
  • 169
21
votes
3 answers

How can I know if an ARM library is using hardfp?

I don't have access to the build command, I just have the library in my system. I guess I could build an hardfp executable that links against it and test, but I'm wondering if there's an easier way.
Sergio Martins
  • 897
  • 2
  • 8
  • 18
21
votes
8 answers

Is Loop Hoisting still a valid manual optimization for C code?

Using the latest gcc compiler, do I still have to think about these types of manual loop optimizations, or will the compiler take care of them for me well enough?
blueberryfields
  • 45,910
  • 28
  • 89
  • 168
21
votes
6 answers

Xcode install on OSX 10.9 - clang: error: no input files

I'm in the process of installing XCode Command Line Tools onto OSX 10.9 Mavericks I did a successful install XCode: $ xcode-select -p /Library/Developer/CommandLineTools However when I type in either $ clang or $ gcc it returns: clang: error: no…
user2925321
  • 233
  • 1
  • 2
  • 4
21
votes
3 answers

Strange array initialize expression?

What is the meaning of following Code? Code is from the regression test suite of GCC. static char * name[] = { [0x80000000] = "bar" };
ted
  • 3,911
  • 3
  • 26
  • 49
21
votes
2 answers

Clang " couldn't infer template argument " whereas gcc / g++ can. Which is right?

I have been trying to compile a project (which is fine using gcc/g++) with clang and compilation stuck on a template invocation. I've tried to create the simplest similar piece of code exhibiting the same error message. Here it is: #include…
Max
  • 313
  • 2
  • 4
21
votes
5 answers

How to cross compile from Mac OS X to Linux x86?

I'm running Mac OS X 10.5.8 and want to compile for target CentOS 5.3 with GCC 4.1.2. How could I: Compile GCC 4.1.2 toolchain and related tools? Use that tool to cross compile for target CentOS 5.3? Any help is greatly appreciated!
Viet
  • 17,944
  • 33
  • 103
  • 135
21
votes
4 answers

Where are the symbols etext, edata and end defined?

This is a code from Linux man page: #include #include extern char etext, edata, end; int main() { printf("First address past:\n"); printf(" program text (etext) %10p\n", &etext); printf(" initialized…
atv
  • 1,950
  • 4
  • 21
  • 26
21
votes
2 answers

How to specify register constraints on the Intel x86_64 register r8 to r15 in GCC inline assembly?

Here's the list of register loading codes: a eax b ebx c ecx d edx S esi D edi I constant value (0 to 31) q,r dynamically allocated register (see below) g eax, ebx, ecx,…
Jin Chen
  • 632
  • 1
  • 4
  • 10
21
votes
7 answers

One class with multiple implementation files

Is there anything wrong with having a single class (one .h) implemented over multiple source files? I realize that this could be a symptom of too much code in a single class, but is there anything technically wrong with it? For instance: Foo.h class…
Andrew Garrison
  • 6,977
  • 11
  • 50
  • 77
21
votes
2 answers

Understanding gcc -S output

I did gcc -S on the very complex program below on x86_64: int main() { int x = 3; x = 5; return 0; } And what I got was: .file "main.c" .text .globl main .type main, @function main: .LFB0: …
Shmoopy
  • 5,334
  • 4
  • 36
  • 72
21
votes
4 answers

understanding the __libc_init_array

I viewed the source code of __libc_init_array from http://newlib.sourcearchive.com/documentation/1.18.0/init_8c-source.html . But I don't quite understand what this function does. I know that these symbols /* These magic symbols are provided by…
Pony279
  • 403
  • 1
  • 6
  • 12
21
votes
3 answers

How to redirect the output of gcc compiler to a file?

Redirection operator does not work. So how should we do it? One more question, in makefile, how can we give arguments from command line, like run: a.out ./a.out ****
avd
  • 13,993
  • 32
  • 78
  • 99
21
votes
3 answers

gdb breakpoint on pthread_create

I am trying to set a breakpoint in linux in gdb for a program creating threads. I would like to set a breakpoint on thread creation, but unfortunately pthread_create is a versioned symbol, and I can't get its full name. If I type: catch…
Juan
  • 3,667
  • 3
  • 28
  • 32
21
votes
5 answers

GCC, stringification, and inline GLSL?

I'd like to declare GLSL shader strings inline using macro stringification: #define STRINGIFY(A) #A const GLchar* vert = STRINGIFY( #version 120\n attribute vec2 position; void main() { gl_Position = vec4( position, 0.0, 1.0 ); } ); This…
genpfault
  • 51,148
  • 11
  • 85
  • 139