$gcc -v gcc version 4.4.3 20091104 (prerelease) (GCC) $gcc -c pid.c kernel/pid.c: In function 'find_pid_ns': kernel/pid.c:299: internal compiler error: tree check: expected integer_cst, have nop_expr in int_cst_value, at tree.c:8301 Please submit a full bug report, with preprocessed source if appropriate. See <http://gcc.gnu.org/bugs.html> for instructions.
Created attachment 18961 [details] the source
Seems to be caused by the PR38699 changes. Looking into it.
Shorter testcase: /* PR middle-end/41935 */ extern void abort (void); struct A { int a; int b[10]; }; int foo (struct A *p) { return __builtin_offsetof (struct A, b[p->a]); } int main () { struct A a; a.a = 7; if (foo (&a) != 7 * sizeof (int) + __builtin_offsetof (struct A, b)) abort (); a.a = 2; if (foo (&a) != 2 * sizeof (int) + __builtin_offsetof (struct A, b)) abort (); return 0; }
Created attachment 18962 [details] gcc45-pr41935.patch Patch I'm going to bootstrap/regtest.
*** Bug 41945 has been marked as a duplicate of this bug. ***
Subject: Bug 41935 Author: jakub Date: Fri Nov 6 08:46:45 2009 New Revision: 153962 URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=153962 Log: PR middle-end/41935 * c-common.c (fold_offsetof_1) <case ARRAY_REF>: Don't crash for VLAs or non-constant index, allow index one past the last element and allow exceeding array bound in arrays that might be used as flexible array members. * gcc.dg/pr41935.c: New test. * c-c++-common/pr41935.c: New test. * c-c++-common/builtin-offsetof.c (f0): Allow index one past the last element. * gcc.c-torture/execute/pr41935.c: New test. Added: trunk/gcc/testsuite/c-c++-common/pr41935.c trunk/gcc/testsuite/gcc.c-torture/execute/pr41935.c trunk/gcc/testsuite/gcc.dg/pr41935.c Modified: trunk/gcc/ChangeLog trunk/gcc/c-common.c trunk/gcc/testsuite/ChangeLog trunk/gcc/testsuite/c-c++-common/builtin-offsetof.c
Fixed. On the 4.4 branch by http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=153944 - partial reversion of the patch that introduced this problem.
*** Bug 41968 has been marked as a duplicate of this bug. ***
*** Bug 41955 has been marked as a duplicate of this bug. ***
Subject: Bug 41935 Author: hjl Date: Fri Nov 20 14:49:22 2009 New Revision: 154366 URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=154366 Log: 2009-11-20 H.J. Lu <hongjiu.lu@intel.com> Backport from mainline: 2009-11-18 Alexandre Oliva <aoliva@redhat.com> PR debug/41926 * gcc.dg/vect/vect-debug-pr41926.c: New. 2009-11-16 Paolo Carlini <paolo.carlini@oracle.com> PR c++/42055 * g++.dg/template/crash92.C: New. 2009-11-08 Richard Guenther <rguenther@suse.de> PR rtl-optimization/41928 * gfortran.dg/pr41928.f90: New testcase. 2009-11-06 Jakub Jelinek <jakub@redhat.com> PR middle-end/41935 * gcc.dg/pr41935.c: New test. * c-c++-common/pr41935.c: New test. * gcc.c-torture/execute/pr41935.c: New test. 2009-11-04 Richard Guenther <rguenther@suse.de> PR tree-optimization/41919 * gcc.c-torture/execute/pr41919.c: New testcase. 2009-11-03 Tobias Burnus <burnus@net-b.de> PR fortran/41907 * gfortran.dg/missing_optional_dummy_6.f90: New test. 2009-11-02 Martin Jambor <mjambor@suse.cz> PR tree-optimization/41750 * gcc.c-torture/execute/pr41750.c: New test. 2009-11-02 Jakub Jelinek <jakub@redhat.com> PR tree-optimization/41841 * gcc.dg/pr41841.c: New test. Added: branches/gcc-4_4-branch/gcc/testsuite/c-c++-common/pr41935.c - copied unchanged from r154365, trunk/gcc/testsuite/c-c++-common/pr41935.c branches/gcc-4_4-branch/gcc/testsuite/g++.dg/template/crash92.C - copied unchanged from r154365, trunk/gcc/testsuite/g++.dg/template/crash92.C branches/gcc-4_4-branch/gcc/testsuite/gcc.c-torture/execute/pr41750.c - copied unchanged from r154365, trunk/gcc/testsuite/gcc.c-torture/execute/pr41750.c branches/gcc-4_4-branch/gcc/testsuite/gcc.c-torture/execute/pr41919.c - copied unchanged from r154365, trunk/gcc/testsuite/gcc.c-torture/execute/pr41919.c branches/gcc-4_4-branch/gcc/testsuite/gcc.c-torture/execute/pr41935.c - copied unchanged from r154365, trunk/gcc/testsuite/gcc.c-torture/execute/pr41935.c branches/gcc-4_4-branch/gcc/testsuite/gcc.dg/pr41841.c - copied unchanged from r154365, trunk/gcc/testsuite/gcc.dg/pr41841.c branches/gcc-4_4-branch/gcc/testsuite/gcc.dg/pr41935.c - copied unchanged from r154365, trunk/gcc/testsuite/gcc.dg/pr41935.c branches/gcc-4_4-branch/gcc/testsuite/gcc.dg/vect/vect-debug-pr41926.c - copied unchanged from r154365, trunk/gcc/testsuite/gcc.dg/vect/vect-debug-pr41926.c branches/gcc-4_4-branch/gcc/testsuite/gfortran.dg/missing_optional_dummy_6.f90 - copied unchanged from r154365, trunk/gcc/testsuite/gfortran.dg/missing_optional_dummy_6.f90 branches/gcc-4_4-branch/gcc/testsuite/gfortran.dg/pr41928.f90 - copied unchanged from r154365, trunk/gcc/testsuite/gfortran.dg/pr41928.f90 Modified: branches/gcc-4_4-branch/gcc/testsuite/ChangeLog