As a general part of testing for my platform (UnixWare), I always run teh testsuites with -fPIC (I also multilib for -fPIC). There is a general problem with PIC, and its not unique to UnixWare, many of the same tests fail on Linux when running the test suites with -fPIC. Many of the errors are along the lines of:
cant find a register in class 'GENERAL_REGS' while reloading 'asm' For some of the test cases below, I believe its simply becuase of the way the test case is written. However, some I think are more problematic. They compile OK but dont run when compiled -fPIC, but run fine when compiled without it. In the list of test cases below, they are marked with '*'. Those marked with '+' are the ones that eject the GENERAL_REGS error above. The ones marked with 'L' fail on Linux too. + L gcc.c-torture/compile/20000804-1.c -O0 + L gcc.c-torture/compile/20000804-1.c -O1 * gcc.c-torture/execute/20050121-1.c -O0 * gcc.c-torture/execute/20050121-1.c -O1 * gcc.c-torture/execute/20050121-1.c -O2 * gcc.c-torture/execute/20050121-1.c -O3 -fomit-frame-pointer * gcc.c-torture/execute/20050121-1.c -O3 -g * gcc.c-torture/execute/20050121-1.c -Os * gcc.c-torture/execute/960512-1.c -O0 * gcc.c-torture/execute/960512-1.c -O1 * gcc.c-torture/execute/960512-1.c -O2 * gcc.c-torture/execute/960512-1.c -O3 -fomit-frame-pointer * gcc.c-torture/execute/960512-1.c -O3 -g * gcc.c-torture/execute/960512-1.c -Os * gcc.c-torture/execute/complex-1.c -O0 * gcc.c-torture/execute/complex-1.c -O1 * gcc.c-torture/execute/complex-1.c -O2 * gcc.c-torture/execute/complex-1.c -O3 -fomit-frame-pointer * gcc.c-torture/execute/complex-1.c -O3 -g * gcc.c-torture/execute/complex-1.c -Os * gcc.c-torture/execute/complex-2.c -O0 * gcc.c-torture/execute/complex-2.c -O1 * gcc.c-torture/execute/complex-2.c -O2 * gcc.c-torture/execute/complex-2.c -O3 -fomit-frame-pointer * gcc.c-torture/execute/complex-2.c -O3 -g * gcc.c-torture/execute/complex-2.c -Os * gcc.c-torture/execute/complex-6.c -O0 * gcc.c-torture/execute/complex-6.c -O1 * gcc.c-torture/execute/complex-6.c -O2 * gcc.c-torture/execute/complex-6.c -O3 -fomit-frame-pointer * gcc.c-torture/execute/complex-6.c -O3 -g * gcc.c-torture/execute/complex-6.c -Os * gcc.dg/compat/scalar-return-3 c_compat_x_tst.o-c_compat_y_tst.o gcc.dg/compat/vector-1_x.c gcc.dg/compat/vector-2_x.c (insn 48 47 34 (set (reg:SI 21 xmm0) (mem:SI (plus:SI (reg/f:SI 6 bp) (const_int -44 [0xffffffd4)) [0 S4 A8] 37 {*movsi_1_nointerunit} (nil) (nil))) ICE: in extract_constrain_insn_cached, at recog.c:2000 gcc.dg/compat/vector-1_y.c compile fails with: In function test_v16qi:9 unable to find a register to spill in class `GENERAL_REGS'. This is the insn: (insn 45 49 46 0 (set (subreg:SI (reg:V16QI 73) 0) (subreg:SI (reg:V16QI 21 xmm0) 0)) 37 {*movsi_1_nointerunit} (nil) (nill)) gcc.dg/compat/vector-2_y.c compile fails with: In function test_v4sf:9 unable to find a register to spill in class `GENERAL_REGS'. This is the insn: (insn 45 49 46 0 (set (subreg:SI (reg:V4SF 73) 0) (subreg:SI (reg:V16QI 21 xmm0) 0)) 37 {*movsi_1_nointerunit} (nil) (nill)) gcc.dg/20011119-1.c fails (also on Linux) with: 20011119-1.c:69: warning: asm operand 0 probably doesn't match constraints 20011119-1.c:69: error: impossible constraint in asm gcc.dg/20020919-1.c fails (also on Linux) with: error: PIC register '%ebx' clobbered by asm gcc.dg/clobbers.c fails the same way gcc.dg/i386-387-3.c gcc.dg/i386-387-4.c gcc.dg/i386-cmov1.c gcc.dg/i386-mul.c gcc.dg/i386-ssetype-1.c gcc.dg/i386-ssetype-3.c gcc.dg/i386-ssetype-5.c All fail in assemble scans because the test cases dont take PIC into account. This isnt a compiler error, but a test case error. All fail on Linux too. gcc.dg/sibcall-6.c execution test fails (on linux too) I suspect that -fPIC doesn't get nearly as much testing as it should, and I also bet that there is a solution to almost all of these thats going to turn out to be pretty simple, and will probably solve them all, as they mostly seem very related. -- Summary: Severe outages with -fPIC Product: gcc Version: 3.4.4 Status: UNCONFIRMED Severity: critical Priority: P1 Component: target AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: jkj at sco dot com CC: gcc-bugs at gcc dot gnu dot org GCC build triplet: i586-pc-sysv5 i686-pc-linux-gnu GCC host triplet: i586-pc-sysv5 i686-pc-linux-gnu GCC target triplet: i586-pc-sysv5 i686-pc-linux-gnu http://gcc.gnu.org/bugzilla/show_bug.cgi?id=23224