Questions tagged [gcc4]

Version 4.x of GCC (GNU Compiler Collection). It's the de facto standard C compiler on Linux and supports many other languages and platforms as well.

Version 4.0.0 was released on 2005-04-20. Version 4.9.4 was released on 2016-08-03.

See also:

184 questions
4
votes
1 answer

gcc 4.5 installation problem under ubuntu

I tried to install gcc 4.5 on ubuntu 10.04 but failed. Here is a compile error that I don't know how to solve. Is there anyone successfully install the latest gcc on ubuntu? Following is my steps and the error message, I'd like to know where is the…
Claire Huang
  • 961
  • 1
  • 18
  • 30
4
votes
2 answers

std::forward_as_tuple in G++ 4.5.0

I have a pressing need for the function std::forward_as_tuple, but am restricted to using GCC 4.5.0 (I know this is a bad situation to put oneself into, but it would solve a lot of problems for me, so please keep the snarky remarks to a minimum).…
masaers
  • 697
  • 9
  • 21
4
votes
1 answer

How to make OpenMP work with MinGW-64 under Cygwin?

The Scenario I am developing an application in C99 ANSI C that uses OpenMP and GMP. It's natural habitat will be a linux machine with plenty of cores, so there's basically no big trouble there, but for reasons I do not want to debate here, I have to…
Jesko Hüttenhain
  • 1,278
  • 10
  • 28
4
votes
1 answer

Why does this code cause a Floating point exception - SIGFPE

Using gcc 4.7: $ gcc --version gcc (GCC) 4.7.0 20120505 (prerelease) Code listing (test.c): #include struct test { int before; char start[0]; unsigned int v1; unsigned int v2; unsigned int v3; char end[0]; …
Wade
  • 3,585
  • 2
  • 22
  • 27
3
votes
1 answer

Access violation 0xc0000005 on exit with JNI Cygwin code on Windows XP

I'm stumped on this. I have JNI code that works on Ubuntu 11 and MacOSX but cause problems with Windows. JRE version: 6.0_31-b05 OS: Windows XP with gcc 4. Modified jni_md.h to avoid the _int64 compile error:…
Calvin Cheng
  • 61
  • 1
  • 4
3
votes
3 answers

Tools and methods to identify/prevent static buffer overruns

Are there any tools or methods that can identify buffer overruns in statically defined arrays (ie. char[1234] rather than malloc(1234))? I spent most of yesterday tracking down crashes and odd behaviour which ultimately turned out to be caused by…
Burhan Ali
  • 2,258
  • 1
  • 28
  • 38
3
votes
6 answers

Can't figure out why this trimming function won't work correctly

=============================================================================== void trim(const char * orig, char * dest) { size_t front = 0; size_t end = sizeof(orig) - 1; size_t counter = 0; char * tmp = null; if (sizeof(orig)…
Sagar
  • 9,456
  • 6
  • 54
  • 96
3
votes
2 answers

No gcc 4.2 compiler option in Xcode 4?

In my Xcode 4 installation, I only have 2 compiler options: Apple LLVM compiler 3.0 GCC LLVM 4.2 In many Xcode examples I have seen that GCC 4.2 is shown as a third option, but this simply isn't there. I intentionally did a clean installation of…
MOK9
  • 375
  • 4
  • 9
3
votes
1 answer

Why does a virtual destructor write to memory?

Recently, when working with custom allocator code and placement new+delete, I noticed something that surprised me: When a virtual destructor is called, it writes to the object's soon-to-be-freed memory. Why is that? (update) Aside: I'm more…
jwd
  • 10,837
  • 3
  • 43
  • 67
3
votes
1 answer

Static constants of templated class

I have been playing around with template classes and constants in gcc 4.8.2 and came across an interesting linker error: #include using namespace std; template class A { public: static const T param = m; T value; …
Filip
  • 480
  • 2
  • 9
3
votes
3 answers

Why isn't the gcc 4.x.x series compilers installed by MinGW by default?

Currently, MinGW's only installs the 3.x.x series of the gcc compiler by default. However, it looks like the 4.x.x series of compilers have been out for some time, and as others have mentioned, it seems to work just fine. Is there any reason why…
Robert P
  • 15,707
  • 10
  • 68
  • 112
3
votes
2 answers

Post-increment, function calls, sequence point concept in GCC

There is a code fragment that GCC produce the result I didn't expect: (I am using gcc version 4.6.1 Ubuntu/Linaro 4.6.1-9ubuntu3 for target i686-linux-gnu) [test.c] #include int *ptr; int f(void) { (*ptr)++; return 1; } int…
2
votes
2 answers

Examples showing how switching to a modern C compiler can help discover bugs?

I am preparing a note to convince people that switching from GCC2 to GCC4 (as a C compiler) is a good idea. In particular, I think it can reveal existing bugs. I would like to give examples, but as a Java programmer my experience of this situations…
Nicolas Raoul
  • 58,567
  • 58
  • 222
  • 373
2
votes
1 answer

C++ implicit conversion and universal forwarding on gcc 7.5

I am creating a library component that uses universal forwarding. This works fine in most cases but I have encountered a case where our linux build (seeminingly) incorrectly uses a copy constructor instead of a move constructor. I was able to…
turoni
  • 1,345
  • 1
  • 18
  • 37
2
votes
2 answers

Linking to stdc++ with CMake and GCC 4.1.2

I am developing a library and need to make sure it compiles with 4.1.2(I know, it brings me no pleasure). So on a Fedora 14 Machine I downloaded, compiled and installed GCC41. Now in CMake I only change the following to…
bgp2000
  • 1,070
  • 13
  • 32