A 'field offset' macro which has worked so far (up to gcc-3.4.3) now
        causes an ICE.

Environment:
System: Linux suse2 2.4.19-64GB-SMP #1 SMP Mon Oct 21 18:48:05 UTC 2002 i686
unknown
Architecture: i686


host: i686-pc-linux-gnu
build: i686-pc-linux-gnu
target: i686-pc-linux-gnu
configured with: ../gcc-4.0.2/configure --prefix=/usr/local/gnu/gcc/4.0.2
--enable-languages=c,c++

How-To-Repeat:
        Compile the program below with 'gcc -c':
/****/
typedef struct {
        char name;
} S;
void f()
{
        char a[(int)&(((S*)8)->name)];
} 
/****/
        The compiler output is:
bug.c: In function 'f':
bug.c:5: internal compiler error: in tree_low_cst, at tree.c:3850


------- Comment #1 from yuvalk at mainsoft dot com  2006-01-05 21:39 -------
Fix:
        Use the GCC offsetof macro from stddef.h


-- 
           Summary: ICE when using (int)(&((S*)0)->field) as array size
           Product: gcc
           Version: 4.0.2
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: yuvalk at mainsoft dot com
 GCC build triplet: i686-pc-linux-gnu
  GCC host triplet: i686-pc-linux-gnu
GCC target triplet: i686-pc-linux-gnu


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=25682


Reply via email to