seen with 20100107 on x86_64-linux-gnu with a biarch compiler: works without -fPIC or with -O1 $ gcc -m32 -c -g -O2 -fPIC stabs.i ../../../dlls/dbghelp/stabs.c:1533:1: internal compiler error: output_operand: invalid expression as operand Please submit a full bug report, with preprocessed source if appropriate.
Created attachment 19565 [details] preprocessed source
This is caused by revision 151917: http://gcc.gnu.org/ml/gcc-cvs/2009-09/msg00665.html
Created attachment 19568 [details] somewhat reduced testcase
More reduced testcase (-m32 -g -O2 -fpic): struct A { unsigned a1; char a2[15]; }; struct B { long b1; unsigned char b2; long b3; }; struct C { void *c1; unsigned c2; unsigned c3; }; static struct A v1; struct A *const v2 = &v1; static inline int foo (void) { int *v; __asm__ __volatile__ ("" : "=r" (v)); return v[1]; } static void bar (struct C *x) { if (x->c2 == x->c3 && x->c1) f1 (foo (), x->c1, x->c3 * sizeof (x->c1[0])); } void baz (struct B *y) { int i; const char *j; char *k; char x[64]; for (i = 0; i < sizeof (struct B); i++, y) { switch (y->b2) { case 0x20: if (__builtin_strchr (j, '=')) continue; } switch (y->b2) { case 0x80: bar (&x); f2 (y->b3); case 0x2e: case 0x4e: break; default: if (v2->a1) f2 (y->b2); } k[0] = '\0'; if (v2->a1) f2 (y->b1); } }
Looks like some var-tracking bug. We have: (insn:TI 108 37 38 3 (set (reg/f:SI 2 cx [93]) (const:SI (unspec:SI [(symbol_ref:SI ("v1") [flags 0x2] <var_decl 0x7fc316f38000 v1>)] 1))) 247 {*lea_1} (expr_list:REG_EQUAL (const:SI (unspec:SI [(symbol_ref:SI ("v1") [flags 0x2] <var_decl 0x7fc316f38000 v1>)] 1)) (nil))) and then: (insn:TI 57 56 59 18 pr42715.i:12 (parallel [(set (reg:SI 2 cx [orig:86 v ] [86]) (asm_operands/v:SI ("") ("=r") 0 []...) (debug_insn 59 57 60 18 pr42715.i:12 (var_location:SI v (reg:SI 2 cx [orig:86 v ] [86])) -1 (nil)) ... (call_insn:TI 64 63 190 18 pr42715.i:20 (set (reg:SI 0 ax) ...) (jump_insn 190 64 191 18 (set (pc) (label_ref 65)) -1 (nil) -> 65) with no labels in between 57 and 190. But var-tracking somehow manages to resurrect the unspec value of cx that cx obviously doesn't have after the call (where it has undefined value). Alex, can you please have a look?
Mine (testing a patch)
Subject: Bug 42715 Author: jakub Date: Thu Jan 21 00:42:02 2010 New Revision: 156102 URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=156102 Log: PR debug/42715 * var-tracking.c (use_type): Choose MO_VAL_SET for REGs set without a cselib val. (count_uses): Accept MO_VAL_SET with no val on stores. (add_stores): Likewise. * gcc.dg/pr42715.c: New. Added: trunk/gcc/testsuite/gcc.dg/pr42715.c Modified: trunk/gcc/ChangeLog trunk/gcc/testsuite/ChangeLog trunk/gcc/var-tracking.c
Fixed.
Subject: Bug 42715 Author: hjl Date: Sun Feb 7 04:41:22 2010 New Revision: 156562 URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=156562 Log: Backport testcases from mainline to 4.4. 2010-02-06 H.J. Lu <hongjiu.lu@intel.com> Backport from mainline: 2010-02-05 Dodji Seketeli <dodji@redhat.com> PR c++/42915 * g++.dg/other/crash-9.C: New test. 2010-02-03 Jason Merrill <jason@redhat.com> PR c++/40138 * g++.dg/ext/builtin11.C: New. 2010-02-03 Richard Guenther <rguenther@suse.de> PR tree-optimization/42944 * gcc.dg/errno-1.c: New testcase. 2010-02-03 Richard Guenther <rguenther@suse.de> PR middle-end/42927 * gcc.c-torture/compile/pr42927.c: New testcase. 2010-01-29 Dodji Seketeli <dodji@redhat.com> PR c++/42758 PR c++/42634 PR c++/42336 PR c++/42797 PR c++/42880 * g++.dg/other/crash-5.C: New test. * g++.dg/other/crash-7.C: New test. * g++.dg/other/crash-8.C: New test. 2010-01-28 Uros Bizjak <ubizjak@gmail.com> PR target/42891 * gcc.target/i386/pr42891.c: New test. 2010-01-28 Richard Guenther <rguenther@suse.de> PR middle-end/42883 * g++.dg/torture/pr42883.C: New testcase. 2010-01-28 Michael Matz <matz@suse.de> * gcc.target/i386/pr42881.c: New test. 2010-01-28 Dodji Seketeli <dodji@redhat.com> PR c++/42713 PR c++/42820 * g++.dg/template/typedef27.C: New test case. * g++.dg/template/typedef28.C: New test case. 2010-01-27 Jakub Jelinek <jakub@redhat.com> PR middle-end/42874 * gcc.dg/vla-22.c: New test. 2010-01-26 Richard Guenther <rguenther@suse.de> PR tree-optimization/42250 * gcc.dg/pr42250.c: New testcase. 2010-01-25 Tobias Burnus <burnus@net-b.de> PR fortran/42858 * gfortran.dg/generic_21.f90: New test. 2010-01-21 Martin Jambor <mjambor@suse.cz> PR tree-optimization/42585 * gcc.dg/tree-ssa/pr42585.c: New test. 2010-01-20 Alexandre Oliva <aoliva@redhat.com> PR debug/42715 * gcc.dg/pr42715.c: New. 2010-01-20 Richard Guenther <rguenther@suse.de> PR tree-optimization/42717 * gcc.c-torture/compile/pr42717.c: New testcase. 2010-01-19 Paul Thomas <pault@gcc.gnu.org> PR fortran/42783 * gfortran.dg/bounds_check_15.f90 : New test. 2010-01-18 Dodji Seketeli <dodji@redhat.com> PR c++/42766 * g++.dg/conversion/op6.C: New test. 2010-01-18 Richard Guenther <rguenther@suse.de> PR tree-optimization/42781 * gfortran.fortran-torture/compile/pr42781.f90: New testcase. 2010-01-17 Richard Guenther <rguenther@suse.de> PR middle-end/42248 * gcc.c-torture/execute/pr42248.c: New testcase. 2010-01-17 Janus Weil <janus@gcc.gnu.org> PR fortran/42677 * gfortran.dg/interface_assignment_5.f90: New test. 2010-01-15 Richard Guenther <rguenther@suse.de> PR middle-end/42739 * g++.dg/torture/pr42739.C: New testcase. 2010-01-14 Jerry DeLisle <jvdelisle@gcc.gnu.org> PR fortran/42684 * gfortran.dg/interface_31.f90: New test. 2010-01-14 Martin Jambor <mjambor@suse.cz> PR tree-optimization/42706 * gcc.dg/ipa/pr42706.c: New testcase. 2010-01-14 Martin Jambor <mjambor@suse.cz> PR tree-optimization/42714 * g++.dg/torture/pr42714.C: New test. 2010-01-14 Alexander Monakov <amonakov@ispras.ru> PR rtl-optimization/42388 * gcc.dg/pr42388.c: New. 2010-01-14 Alexander Monakov <amonakov@ispras.ru> PR rtl-optimization/42294 * gfortran.dg/pr42294.f: New. 2010-01-14 Ira Rosen <irar@il.ibm.com> PR tree-optimization/42709 * gcc.dg/vect/pr42709.c: New test. 2010-01-13 Richard Guenther <rguenther@suse.de> PR tree-optimization/42730 * gcc.c-torture/compile/pr42730.c: New testcase. 2010-01-13 Martin Jambor <mjambor@suse.cz> PR tree-optimization/42704 * g++.dg/torture/pr42704.C: New test. 2010-01-13 Martin Jambor <mjambor@suse.cz> PR tree-optimization/42703 * gcc.c-torture/compile/pr42703.c: New test. 2010-01-13 Richard Guenther <rguenther@suse.de> PR tree-optimization/42705 * gcc.c-torture/compile/pr42705.c: New testcase. 2010-01-13 Richard Guenther <rguenther@suse.de> PR middle-end/42716 * gcc.c-torture/compile/pr42716.c: New testcase. 2010-01-12 Joseph Myers <joseph@codesourcery.com> PR c/42708 * gcc.c-torture/compile/pr42708-1.c: New test. 2010-01-09 Alexandre Oliva <aoliva@redhat.com> PR middle-end/42363 * gcc.dg/torture/pr42363.c: New. 2010-01-09 Alexandre Oliva <aoliva@redhat.com> PR debug/42604 PR debug/42395 * gcc.dg/vect/pr42604.c: New. * gcc.dg/vect/pr42395.c: New. 2010-01-09 Richard Guenther <rguenther@suse.de> PR middle-end/42512 * gcc.c-torture/execute/pr42512.c: New testcase. Added: branches/gcc-4_4-branch/gcc/testsuite/g++.dg/conversion/op6.C - copied unchanged from r156561, trunk/gcc/testsuite/g++.dg/conversion/op6.C branches/gcc-4_4-branch/gcc/testsuite/g++.dg/ext/builtin11.C - copied unchanged from r156561, trunk/gcc/testsuite/g++.dg/ext/builtin11.C branches/gcc-4_4-branch/gcc/testsuite/g++.dg/other/crash-5.C - copied unchanged from r156561, trunk/gcc/testsuite/g++.dg/other/crash-5.C branches/gcc-4_4-branch/gcc/testsuite/g++.dg/other/crash-7.C - copied unchanged from r156561, trunk/gcc/testsuite/g++.dg/other/crash-7.C branches/gcc-4_4-branch/gcc/testsuite/g++.dg/other/crash-8.C - copied unchanged from r156561, trunk/gcc/testsuite/g++.dg/other/crash-8.C branches/gcc-4_4-branch/gcc/testsuite/g++.dg/other/crash-9.C - copied unchanged from r156561, trunk/gcc/testsuite/g++.dg/other/crash-9.C branches/gcc-4_4-branch/gcc/testsuite/g++.dg/template/typedef27.C - copied unchanged from r156561, trunk/gcc/testsuite/g++.dg/template/typedef27.C branches/gcc-4_4-branch/gcc/testsuite/g++.dg/template/typedef28.C - copied unchanged from r156561, trunk/gcc/testsuite/g++.dg/template/typedef28.C branches/gcc-4_4-branch/gcc/testsuite/g++.dg/torture/pr42704.C - copied unchanged from r156561, trunk/gcc/testsuite/g++.dg/torture/pr42704.C branches/gcc-4_4-branch/gcc/testsuite/g++.dg/torture/pr42714.C - copied unchanged from r156561, trunk/gcc/testsuite/g++.dg/torture/pr42714.C branches/gcc-4_4-branch/gcc/testsuite/g++.dg/torture/pr42739.C - copied unchanged from r156561, trunk/gcc/testsuite/g++.dg/torture/pr42739.C branches/gcc-4_4-branch/gcc/testsuite/g++.dg/torture/pr42883.C - copied unchanged from r156561, trunk/gcc/testsuite/g++.dg/torture/pr42883.C branches/gcc-4_4-branch/gcc/testsuite/gcc.c-torture/compile/pr42703.c - copied unchanged from r156561, trunk/gcc/testsuite/gcc.c-torture/compile/pr42703.c branches/gcc-4_4-branch/gcc/testsuite/gcc.c-torture/compile/pr42705.c - copied unchanged from r156561, trunk/gcc/testsuite/gcc.c-torture/compile/pr42705.c branches/gcc-4_4-branch/gcc/testsuite/gcc.c-torture/compile/pr42708-1.c - copied unchanged from r156561, trunk/gcc/testsuite/gcc.c-torture/compile/pr42708-1.c branches/gcc-4_4-branch/gcc/testsuite/gcc.c-torture/compile/pr42716.c - copied unchanged from r156561, trunk/gcc/testsuite/gcc.c-torture/compile/pr42716.c branches/gcc-4_4-branch/gcc/testsuite/gcc.c-torture/compile/pr42717.c - copied unchanged from r156561, trunk/gcc/testsuite/gcc.c-torture/compile/pr42717.c branches/gcc-4_4-branch/gcc/testsuite/gcc.c-torture/compile/pr42730.c - copied unchanged from r156561, trunk/gcc/testsuite/gcc.c-torture/compile/pr42730.c branches/gcc-4_4-branch/gcc/testsuite/gcc.c-torture/compile/pr42927.c - copied unchanged from r156561, trunk/gcc/testsuite/gcc.c-torture/compile/pr42927.c branches/gcc-4_4-branch/gcc/testsuite/gcc.c-torture/execute/pr42248.c - copied unchanged from r156561, trunk/gcc/testsuite/gcc.c-torture/execute/pr42248.c branches/gcc-4_4-branch/gcc/testsuite/gcc.c-torture/execute/pr42512.c - copied unchanged from r156561, trunk/gcc/testsuite/gcc.c-torture/execute/pr42512.c branches/gcc-4_4-branch/gcc/testsuite/gcc.dg/errno-1.c - copied unchanged from r156561, trunk/gcc/testsuite/gcc.dg/errno-1.c branches/gcc-4_4-branch/gcc/testsuite/gcc.dg/ipa/pr42706.c - copied unchanged from r156561, trunk/gcc/testsuite/gcc.dg/ipa/pr42706.c branches/gcc-4_4-branch/gcc/testsuite/gcc.dg/pr42250.c - copied unchanged from r156561, trunk/gcc/testsuite/gcc.dg/pr42250.c branches/gcc-4_4-branch/gcc/testsuite/gcc.dg/pr42388.c - copied unchanged from r156561, trunk/gcc/testsuite/gcc.dg/pr42388.c branches/gcc-4_4-branch/gcc/testsuite/gcc.dg/pr42715.c - copied unchanged from r156561, trunk/gcc/testsuite/gcc.dg/pr42715.c branches/gcc-4_4-branch/gcc/testsuite/gcc.dg/torture/pr42363.c - copied unchanged from r156561, trunk/gcc/testsuite/gcc.dg/torture/pr42363.c branches/gcc-4_4-branch/gcc/testsuite/gcc.dg/tree-ssa/pr42585.c - copied unchanged from r156561, trunk/gcc/testsuite/gcc.dg/tree-ssa/pr42585.c branches/gcc-4_4-branch/gcc/testsuite/gcc.dg/vect/pr42395.c - copied unchanged from r156561, trunk/gcc/testsuite/gcc.dg/vect/pr42395.c branches/gcc-4_4-branch/gcc/testsuite/gcc.dg/vect/pr42604.c - copied unchanged from r156561, trunk/gcc/testsuite/gcc.dg/vect/pr42604.c branches/gcc-4_4-branch/gcc/testsuite/gcc.dg/vect/pr42709.c - copied unchanged from r156561, trunk/gcc/testsuite/gcc.dg/vect/pr42709.c branches/gcc-4_4-branch/gcc/testsuite/gcc.dg/vla-22.c - copied unchanged from r156561, trunk/gcc/testsuite/gcc.dg/vla-22.c branches/gcc-4_4-branch/gcc/testsuite/gcc.target/i386/pr42881.c - copied unchanged from r156561, trunk/gcc/testsuite/gcc.target/i386/pr42881.c branches/gcc-4_4-branch/gcc/testsuite/gcc.target/i386/pr42891.c - copied unchanged from r156561, trunk/gcc/testsuite/gcc.target/i386/pr42891.c branches/gcc-4_4-branch/gcc/testsuite/gfortran.dg/bounds_check_15.f90 - copied unchanged from r156561, trunk/gcc/testsuite/gfortran.dg/bounds_check_15.f90 branches/gcc-4_4-branch/gcc/testsuite/gfortran.dg/generic_21.f90 - copied unchanged from r156561, trunk/gcc/testsuite/gfortran.dg/generic_21.f90 branches/gcc-4_4-branch/gcc/testsuite/gfortran.dg/interface_31.f90 - copied unchanged from r156561, trunk/gcc/testsuite/gfortran.dg/interface_31.f90 branches/gcc-4_4-branch/gcc/testsuite/gfortran.dg/interface_assignment_5.f90 - copied unchanged from r156561, trunk/gcc/testsuite/gfortran.dg/interface_assignment_5.f90 branches/gcc-4_4-branch/gcc/testsuite/gfortran.dg/pr42294.f - copied unchanged from r156561, trunk/gcc/testsuite/gfortran.dg/pr42294.f branches/gcc-4_4-branch/gcc/testsuite/gfortran.fortran-torture/compile/pr42781.f90 - copied unchanged from r156561, trunk/gcc/testsuite/gfortran.fortran-torture/compile/pr42781.f90 Modified: branches/gcc-4_4-branch/gcc/testsuite/ChangeLog