compiled program segfault when -O0 is used to compile
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
gcc-defaults |
Invalid
|
Medium
|
|||
gcc-defaults (Ubuntu) |
Invalid
|
Undecided
|
Unassigned |
Bug Description
I don't know whether this is really a problem, or what not, but I'm attaching logs, and the program which causes it, along with every detail I can think of. When I compile my code, if I compile it -O2, it compiles and runs fine. if I compile it with -O0, it segfaults very early on in the execution. I've made no changes to anything in between compiles.
Compiling the code successfully requires the following libraries:
opengl (mesa)
glut (freeglut)
curl
FTGL (patched, see https:/
procedure is as follows:
./configure
make CFLAGS="-O0"
src/altocumulus
make clean
make CFLAGS="-O2"
src/altocumulus
My code is pretty crappy, please ignore that, I'm still learning the basics of C.
Regardless, the code shouldn't work with one level of optimization and fail with another.
ProblemType: Bug
DistroRelease: Ubuntu 10.04
Package: gcc 4:4.4.3-1ubuntu1
ProcVersionSign
Uname: Linux 2.6.32-22-generic x86_64
NonfreeKernelMo
Architecture: amd64
Date: Wed Jun 9 11:43:21 2010
EcryptfsInUse: Yes
InstallationMedia: Ubuntu 9.10 "Karmic Koala" - Release amd64 (20091027)
ProcEnviron:
PATH=(custom, user)
LANG=en_US.utf8
SHELL=/bin/bash
SourcePackage: gcc-defaults
Changed in gcc-defaults (Ubuntu): | |
status: | New → Confirmed |
Changed in gcc-defaults: | |
importance: | Unknown → Medium |
status: | Unknown → Incomplete |
Changed in gcc-defaults: | |
status: | Incomplete → Invalid |
I have the same problem on both ubuntu 10.04 (not updated, gcc 4.4.3) and ubuntu 11.04 (fully updated, can't check the gcc version right now). According to gdb it crashes in some TFGlyth member function. I really did not expect such problem from gcc...
BTW thanks for the solution, I thought the problem was somwhere in my code.