From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 1759 invoked by alias); 5 Jan 2006 21:39:43 -0000 Received: (qmail 1746 invoked by alias); 5 Jan 2006 21:39:41 -0000 Date: Thu, 05 Jan 2006 21:39:00 -0000 Subject: [Bug c/25682] New: ICE when using (int)(&((S*)0)->field) as array size X-Bugzilla-Reason: CC Message-ID: Reply-To: gcc-bugzilla@gcc.gnu.org To: gcc-bugs@gcc.gnu.org From: "gcc-bugzilla at gcc dot gnu dot org" Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org X-SW-Source: 2006-01/txt/msg00524.txt.bz2 List-Id: 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