Hello, the attached code, when compiled with -O1, produce a code which segfaults. I'm quite embarrassed with the host/target/build triplet asked in the form, since I tested it to segfault on several platforms, namly: powerpc-unknown-linux-gnu gcc (GCC) 3.3.5 (Debian 1:3.3.5-8) powerpc-ibm-aix5.1.0.0 gcc (GCC) 3.3.3 and also on Mac OSX (but I don't have all the version details from here since I asked a friend to do the test for me -- I'll add them later if needed).
Interessingly enough, this test case does not fool the following platform: powerpc-ibm-aix5.2.0.0 gcc version = "2.9-aix51-020209" But the bug I'm tracking in my full featured program also appear on this one, so I suspect that my testcase is too reduced for this one. I can give you pointer to the full featured archive, but I doubt it would help you. Whenever you solve the issues shown by this test case, I'll produce a new one if needed :) I usually compile my code with -g -O2 -g -Wall -Wunused -Wmissing-prototypes -Wmissing-declarations -finline-functions -Wshadow -Wpointer-arith -Wchar-subscripts -Wcomment -Wformat=2 -Wno-unused-variable -Wno-unused-function -Wno-unused-label -Wwrite-strings -Werror -ffast-math -funroll-loops -fno-strict-aliasing on x86, and it didn't trigger anything. My project (and thus the test case) works on the following platforms (with gcc): alphaev67-unknown-linux-gnu hppa64-unknown-linux-gnu i686-pc-linux-gnu ia64-unknown-linux-gnu m68k-unknown-linux-gnu mipsel-unknown-linux-gnu sparc64-unknown-linux-gnu sparc-sun-solaris2.8 x86_64-unknown-linux-gnu The code runs well in valgrind both with and without optimisation on x86, but the poor valgrind-ppc gets completly fooled with the optimized ppc version. I don't include the .i file since the printf is just there for cosmetics. It also segfaults without it. I'm not root on those machines, so installing a new gcc is somewhat impractical for me (but not impossible). In the test case, changing the i value to a global helps a lot, but again, my full featured project still shows the issue, even when the big structs are not allocated on the stack. I'm a bit impressed to fill a bug against gcc, and I hope I do it right. If you need any more information, just tell me. Thanks for your devotion to this mandatory tool, Mt. -- Summary: -01 produce code which segfault on powerpc (linux/macOSx/aix) Product: gcc Version: 3.3.5 Status: UNCONFIRMED Severity: normal Priority: P2 Component: c AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: Martin dot Quinson at loria dot fr CC: Martin dot Quinson at loria dot fr,gcc-bugs at gcc dot gnu dot org GCC build triplet: powerpc-unknown-linux-gnu GCC host triplet: powerpc-unknown-linux-gnu GCC target triplet: powerpc-unknown-linux-gnu http://gcc.gnu.org/bugzilla/show_bug.cgi?id=20327