https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66230
Bug ID: 66230 Summary: Using optimizations causes program to segfault Product: gcc Version: 4.9.2 Status: UNCONFIRMED Severity: major Priority: P3 Component: c Assignee: unassigned at gcc dot gnu.org Reporter: gpnuma at centaurean dot com Target Milestone: --- Hello, First I'd like to point out that the code producing this error compiles and runs fine in gcc 4.8.4-1 for Linux and OS/X and Clang 3.5, 3.6 (Linux) and 6.1 (OS/X), but fails with gcc 4.9.2 when using -O3 on both Linux and OS/X (in debug mode it works fine). The platform used for all these tests was x86_64. To reproduce : clone and build https://github.com/centaurean/density with gcc 4.9.2. Then run the following command : ./benchmark -3 some_file This will turn into a segfault. When I add the line [printf("anything");] just before DENSITY_MEMCPY(... here : https://github.com/centaurean/density/blob/master/src/kernel_lion_decode.c#L187, the program runs again normally without any segfault... that's really super strange. The function that fails is called via an array of function pointers, but I don't think that's the problem since it works with any other compiler.