When compiling the popular GPC polygon clipping library (http://www.cs.man.ac.uk/~toby/alan/software/) with -O2 or -O3 and then processing a special polygon, it fails with a sigsegv on linux.
The program works fine without optimization and with -O. I get the same results with compilers 4.3.2 and 4.3.3, but not with 4.0.2 (at -O3). I've run valgrind on the code and it comes back clean and even works!! I've attached a the preprocessed source (which is large) from the gcc-4.4. This is how it's compile and run: gcc -O2 -o clip main.i gzip -dc polygon.gz | ./clip I've attached also the full source code. I'll try to contact the author as well, perhaps there's a problem with the code when using optimization. -- Summary: GPC polygon clipping library fails with -O2 Product: gcc Version: 4.4.0 Status: UNCONFIRMED Severity: major Priority: P3 Component: c AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: merkert at comcast dot net GCC build triplet: gcc (GCC) 4.4.0 20090130 (experimental) GCC host triplet: Linux linux 2.6.11.4-21.17-smp #1 SMP Fri Apr 6 08:42:34 UTC 200 GCC target triplet: gcc (GCC) 4.4.0 20090130 (experimental) http://gcc.gnu.org/bugzilla/show_bug.cgi?id=39128