public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/25682] New: ICE when using (int)(&((S*)0)->field) as array size
@ 2006-01-05 21:39 gcc-bugzilla at gcc dot gnu dot org
2006-01-05 22:36 ` [Bug c/25682] [4.0/4.1/4.2 Regression] " steven at gcc dot gnu dot org
` (11 more replies)
0 siblings, 12 replies; 13+ messages in thread
From: gcc-bugzilla at gcc dot gnu dot org @ 2006-01-05 21:39 UTC (permalink / raw)
To: gcc-bugs
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
^ permalink raw reply [flat|nested] 13+ messages in thread
* [Bug c/25682] [4.0/4.1/4.2 Regression] ICE when using (int)(&((S*)0)->field) as array size
2006-01-05 21:39 [Bug c/25682] New: ICE when using (int)(&((S*)0)->field) as array size gcc-bugzilla at gcc dot gnu dot org
@ 2006-01-05 22:36 ` steven at gcc dot gnu dot org
2006-01-05 22:42 ` pinskia at gcc dot gnu dot org
` (10 subsequent siblings)
11 siblings, 0 replies; 13+ messages in thread
From: steven at gcc dot gnu dot org @ 2006-01-05 22:36 UTC (permalink / raw)
To: gcc-bugs
--
steven at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |NEW
Ever Confirmed|0 |1
Known to fail| |4.0.2 4.1.0 4.2.0
Last reconfirmed|0000-00-00 00:00:00 |2006-01-05 22:36:33
date| |
Summary|ICE when using |[4.0/4.1/4.2 Regression] ICE
|(int)(&((S*)0)->field) as |when using (int)(&((S*)0)-
|array size |>field) as array size
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=25682
^ permalink raw reply [flat|nested] 13+ messages in thread
* [Bug c/25682] [4.0/4.1/4.2 Regression] ICE when using (int)(&((S*)0)->field) as array size
2006-01-05 21:39 [Bug c/25682] New: ICE when using (int)(&((S*)0)->field) as array size gcc-bugzilla at gcc dot gnu dot org
2006-01-05 22:36 ` [Bug c/25682] [4.0/4.1/4.2 Regression] " steven at gcc dot gnu dot org
@ 2006-01-05 22:42 ` pinskia at gcc dot gnu dot org
2006-01-07 16:01 ` [Bug c/25682] [4.0/4.1/4.2 Regression] ICE when using old sytle offsetof (with non zero start) " pinskia at gcc dot gnu dot org
` (9 subsequent siblings)
11 siblings, 0 replies; 13+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2006-01-05 22:42 UTC (permalink / raw)
To: gcc-bugs
--
pinskia at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |pinskia at gcc dot gnu dot
| |org
Keywords| |ice-on-valid-code
Target Milestone|--- |4.0.3
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=25682
^ permalink raw reply [flat|nested] 13+ messages in thread
* [Bug c/25682] [4.0/4.1/4.2 Regression] ICE when using old sytle offsetof (with non zero start) as array size
2006-01-05 21:39 [Bug c/25682] New: ICE when using (int)(&((S*)0)->field) as array size gcc-bugzilla at gcc dot gnu dot org
2006-01-05 22:36 ` [Bug c/25682] [4.0/4.1/4.2 Regression] " steven at gcc dot gnu dot org
2006-01-05 22:42 ` pinskia at gcc dot gnu dot org
@ 2006-01-07 16:01 ` pinskia at gcc dot gnu dot org
2006-01-14 6:04 ` pinskia at gcc dot gnu dot org
` (8 subsequent siblings)
11 siblings, 0 replies; 13+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2006-01-07 16:01 UTC (permalink / raw)
To: gcc-bugs
------- Comment #2 from pinskia at gcc dot gnu dot org 2006-01-07 16:01 -------
This only happens with a non NULL pointer.
--
pinskia at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
Summary|[4.0/4.1/4.2 Regression] ICE|[4.0/4.1/4.2 Regression] ICE
|when using old sytle |when using old sytle
|offsetof as array size |offsetof (with non zero
| |start) as array size
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=25682
^ permalink raw reply [flat|nested] 13+ messages in thread
* [Bug c/25682] [4.0/4.1/4.2 Regression] ICE when using old sytle offsetof (with non zero start) as array size
2006-01-05 21:39 [Bug c/25682] New: ICE when using (int)(&((S*)0)->field) as array size gcc-bugzilla at gcc dot gnu dot org
` (2 preceding siblings ...)
2006-01-07 16:01 ` [Bug c/25682] [4.0/4.1/4.2 Regression] ICE when using old sytle offsetof (with non zero start) " pinskia at gcc dot gnu dot org
@ 2006-01-14 6:04 ` pinskia at gcc dot gnu dot org
2006-01-15 22:27 ` mmitchel at gcc dot gnu dot org
` (7 subsequent siblings)
11 siblings, 0 replies; 13+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2006-01-14 6:04 UTC (permalink / raw)
To: gcc-bugs
------- Comment #3 from pinskia at gcc dot gnu dot org 2006-01-14 06:04 -------
Janis could you do a regression hunt on this bug?
I think this started after "2004-05-30" but I don't know for sure.
Thanks,
Andrew
--
pinskia at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |janis at gcc dot gnu dot org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=25682
^ permalink raw reply [flat|nested] 13+ messages in thread
* [Bug c/25682] [4.0/4.1/4.2 Regression] ICE when using old sytle offsetof (with non zero start) as array size
2006-01-05 21:39 [Bug c/25682] New: ICE when using (int)(&((S*)0)->field) as array size gcc-bugzilla at gcc dot gnu dot org
` (3 preceding siblings ...)
2006-01-14 6:04 ` pinskia at gcc dot gnu dot org
@ 2006-01-15 22:27 ` mmitchel at gcc dot gnu dot org
2006-01-16 12:46 ` jakub at gcc dot gnu dot org
` (6 subsequent siblings)
11 siblings, 0 replies; 13+ messages in thread
From: mmitchel at gcc dot gnu dot org @ 2006-01-15 22:27 UTC (permalink / raw)
To: gcc-bugs
------- Comment #4 from mmitchel at gcc dot gnu dot org 2006-01-15 22:27 -------
This kind of code is common so this is a P1.
--
mmitchel at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
Priority|P3 |P1
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=25682
^ permalink raw reply [flat|nested] 13+ messages in thread
* [Bug c/25682] [4.0/4.1/4.2 Regression] ICE when using old sytle offsetof (with non zero start) as array size
2006-01-05 21:39 [Bug c/25682] New: ICE when using (int)(&((S*)0)->field) as array size gcc-bugzilla at gcc dot gnu dot org
` (4 preceding siblings ...)
2006-01-15 22:27 ` mmitchel at gcc dot gnu dot org
@ 2006-01-16 12:46 ` jakub at gcc dot gnu dot org
2006-01-16 19:28 ` janis at gcc dot gnu dot org
` (5 subsequent siblings)
11 siblings, 0 replies; 13+ messages in thread
From: jakub at gcc dot gnu dot org @ 2006-01-16 12:46 UTC (permalink / raw)
To: gcc-bugs
--
jakub at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
AssignedTo|unassigned at gcc dot gnu |jakub at gcc dot gnu dot org
|dot org |
URL| |http://gcc.gnu.org/ml/gcc-
| |patches/2006-
| |01/msg00835.html
Status|NEW |ASSIGNED
Last reconfirmed|2006-01-05 22:36:33 |2006-01-16 12:46:23
date| |
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=25682
^ permalink raw reply [flat|nested] 13+ messages in thread
* [Bug c/25682] [4.0/4.1/4.2 Regression] ICE when using old sytle offsetof (with non zero start) as array size
2006-01-05 21:39 [Bug c/25682] New: ICE when using (int)(&((S*)0)->field) as array size gcc-bugzilla at gcc dot gnu dot org
` (5 preceding siblings ...)
2006-01-16 12:46 ` jakub at gcc dot gnu dot org
@ 2006-01-16 19:28 ` janis at gcc dot gnu dot org
2006-01-17 9:58 ` jakub at gcc dot gnu dot org
` (4 subsequent siblings)
11 siblings, 0 replies; 13+ messages in thread
From: janis at gcc dot gnu dot org @ 2006-01-16 19:28 UTC (permalink / raw)
To: gcc-bugs
------- Comment #5 from janis at gcc dot gnu dot org 2006-01-16 19:28 -------
A regression hunt on powerpc-linux using the submitter's testcase identified
the following patch as introducing the failure:
http://gcc.gnu.org/viewcvs?view=rev&rev=87064
r87064 | rth | 2004-09-03 23:50:11 +0000 (Fri, 03 Sep 2004) | 16 lines
PR middle-end/9997
* cfgexpand.c (LOCAL_ALIGNMENT): Provide default.
(STACK_ALIGNMENT_NEEDED, FRAME_GROWS_DOWNWARD): Likewise.
(struct stack_var, EOC, stack_vars, stack_vars_alloc, stack_vars_num,
stack_vars_sorted, stack_vars_conflict, stack_vars_conflict_alloc,
frame_phase, get_decl_align_unit, add_stack_var, triangular_index,
resize_stack_vars_conflict, add_stack_var_conflict,
stack_var_conflict_p, add_alias_set_conflicts, stack_var_size_cmp,
union_stack_vars, partition_stack_vars, dump_stack_var_partition,
expand_one_stack_var_at, expand_stack_vars, expand_one_stack_var,
expand_one_static_var, expand_one_hard_reg_var,
expand_one_register_var, expand_one_error_var, defer_stack_allocation,
expand_one_var, expand_used_vars_for_block, clear_tree_used): New.
(expand_used_vars): Rewrite.
* Makefile.in (cfgexpand.o): Update dependencies.
--
janis at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |rth at gcc dot gnu dot org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=25682
^ permalink raw reply [flat|nested] 13+ messages in thread
* [Bug c/25682] [4.0/4.1/4.2 Regression] ICE when using old sytle offsetof (with non zero start) as array size
2006-01-05 21:39 [Bug c/25682] New: ICE when using (int)(&((S*)0)->field) as array size gcc-bugzilla at gcc dot gnu dot org
` (6 preceding siblings ...)
2006-01-16 19:28 ` janis at gcc dot gnu dot org
@ 2006-01-17 9:58 ` jakub at gcc dot gnu dot org
2006-01-17 10:00 ` jakub at gcc dot gnu dot org
` (3 subsequent siblings)
11 siblings, 0 replies; 13+ messages in thread
From: jakub at gcc dot gnu dot org @ 2006-01-17 9:58 UTC (permalink / raw)
To: gcc-bugs
------- Comment #6 from jakub at gcc dot gnu dot org 2006-01-17 09:58 -------
Subject: Bug 25682
Author: jakub
Date: Tue Jan 17 09:57:56 2006
New Revision: 109812
URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=109812
Log:
PR c/25682
* c-typeck.c (build_unary_op): Fold offsetof-like expressions
even when the pointer is not NULL.
cp/
* decl.c (compute_array_index_type): After issuing not an integral
constant-expression error, set size to 1 to avoid ICEs later on.
testsuite/
* gcc.dg/pr25682.c: New test.
* g++.dg/parse/array-size2.C: New test.
Added:
trunk/gcc/testsuite/g++.dg/parse/array-size2.C
trunk/gcc/testsuite/gcc.dg/pr25682.c
Modified:
trunk/gcc/ChangeLog
trunk/gcc/c-typeck.c
trunk/gcc/cp/ChangeLog
trunk/gcc/cp/decl.c
trunk/gcc/testsuite/ChangeLog
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=25682
^ permalink raw reply [flat|nested] 13+ messages in thread
* [Bug c/25682] [4.0/4.1/4.2 Regression] ICE when using old sytle offsetof (with non zero start) as array size
2006-01-05 21:39 [Bug c/25682] New: ICE when using (int)(&((S*)0)->field) as array size gcc-bugzilla at gcc dot gnu dot org
` (7 preceding siblings ...)
2006-01-17 9:58 ` jakub at gcc dot gnu dot org
@ 2006-01-17 10:00 ` jakub at gcc dot gnu dot org
2006-02-27 20:25 ` [Bug c/25682] [4.0 " mmitchel at gcc dot gnu dot org
` (2 subsequent siblings)
11 siblings, 0 replies; 13+ messages in thread
From: jakub at gcc dot gnu dot org @ 2006-01-17 10:00 UTC (permalink / raw)
To: gcc-bugs
------- Comment #7 from jakub at gcc dot gnu dot org 2006-01-17 10:00 -------
Subject: Bug 25682
Author: jakub
Date: Tue Jan 17 10:00:05 2006
New Revision: 109813
URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=109813
Log:
PR c/25682
* c-typeck.c (build_unary_op): Fold offsetof-like expressions
even when the pointer is not NULL.
cp/
* decl.c (compute_array_index_type): After issuing not an integral
constant-expression error, set size to 1 to avoid ICEs later on.
testsuite/
* gcc.dg/pr25682.c: New test.
* g++.dg/parse/array-size2.C: New test.
Added:
branches/gcc-4_1-branch/gcc/testsuite/g++.dg/parse/array-size2.C
branches/gcc-4_1-branch/gcc/testsuite/gcc.dg/pr25682.c
Modified:
branches/gcc-4_1-branch/gcc/ChangeLog
branches/gcc-4_1-branch/gcc/c-typeck.c
branches/gcc-4_1-branch/gcc/cp/ChangeLog
branches/gcc-4_1-branch/gcc/cp/decl.c
branches/gcc-4_1-branch/gcc/testsuite/ChangeLog
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=25682
^ permalink raw reply [flat|nested] 13+ messages in thread
* [Bug c/25682] [4.0 Regression] ICE when using old sytle offsetof (with non zero start) as array size
2006-01-05 21:39 [Bug c/25682] New: ICE when using (int)(&((S*)0)->field) as array size gcc-bugzilla at gcc dot gnu dot org
` (8 preceding siblings ...)
2006-01-17 10:00 ` jakub at gcc dot gnu dot org
@ 2006-02-27 20:25 ` mmitchel at gcc dot gnu dot org
2006-02-28 11:38 ` jakub at gcc dot gnu dot org
2006-02-28 12:45 ` pinskia at gcc dot gnu dot org
11 siblings, 0 replies; 13+ messages in thread
From: mmitchel at gcc dot gnu dot org @ 2006-02-27 20:25 UTC (permalink / raw)
To: gcc-bugs
------- Comment #8 from mmitchel at gcc dot gnu dot org 2006-02-27 20:23 -------
Jakub, does your patch apply to 4.0?
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=25682
^ permalink raw reply [flat|nested] 13+ messages in thread
* [Bug c/25682] [4.0 Regression] ICE when using old sytle offsetof (with non zero start) as array size
2006-01-05 21:39 [Bug c/25682] New: ICE when using (int)(&((S*)0)->field) as array size gcc-bugzilla at gcc dot gnu dot org
` (9 preceding siblings ...)
2006-02-27 20:25 ` [Bug c/25682] [4.0 " mmitchel at gcc dot gnu dot org
@ 2006-02-28 11:38 ` jakub at gcc dot gnu dot org
2006-02-28 12:45 ` pinskia at gcc dot gnu dot org
11 siblings, 0 replies; 13+ messages in thread
From: jakub at gcc dot gnu dot org @ 2006-02-28 11:38 UTC (permalink / raw)
To: gcc-bugs
------- Comment #9 from jakub at gcc dot gnu dot org 2006-02-28 11:36 -------
Subject: Bug 25682
Author: jakub
Date: Tue Feb 28 11:36:26 2006
New Revision: 111564
URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=111564
Log:
PR c/25682
* c-typeck.c (build_unary_op): Fold offsetof-like expressions
even when the pointer is not NULL.
* decl.c (compute_array_index_type): After issuing not an integral
constant-expression error, set size to 1 to avoid ICEs later on.
* gcc.dg/pr25682.c: New test.
* g++.dg/parse/array-size2.C: New test.
Added:
branches/gcc-4_0-branch/gcc/testsuite/g++.dg/parse/array-size2.C
branches/gcc-4_0-branch/gcc/testsuite/gcc.dg/pr25682.c
Modified:
branches/gcc-4_0-branch/gcc/ChangeLog
branches/gcc-4_0-branch/gcc/c-typeck.c
branches/gcc-4_0-branch/gcc/cp/ChangeLog
branches/gcc-4_0-branch/gcc/cp/decl.c
branches/gcc-4_0-branch/gcc/testsuite/ChangeLog
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=25682
^ permalink raw reply [flat|nested] 13+ messages in thread
* [Bug c/25682] [4.0 Regression] ICE when using old sytle offsetof (with non zero start) as array size
2006-01-05 21:39 [Bug c/25682] New: ICE when using (int)(&((S*)0)->field) as array size gcc-bugzilla at gcc dot gnu dot org
` (10 preceding siblings ...)
2006-02-28 11:38 ` jakub at gcc dot gnu dot org
@ 2006-02-28 12:45 ` pinskia at gcc dot gnu dot org
11 siblings, 0 replies; 13+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2006-02-28 12:45 UTC (permalink / raw)
To: gcc-bugs
------- Comment #10 from pinskia at gcc dot gnu dot org 2006-02-28 12:44 -------
Fixed.
--
pinskia at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|ASSIGNED |RESOLVED
Resolution| |FIXED
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=25682
^ permalink raw reply [flat|nested] 13+ messages in thread
end of thread, other threads:[~2006-02-28 12:44 UTC | newest]
Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-01-05 21:39 [Bug c/25682] New: ICE when using (int)(&((S*)0)->field) as array size gcc-bugzilla at gcc dot gnu dot org
2006-01-05 22:36 ` [Bug c/25682] [4.0/4.1/4.2 Regression] " steven at gcc dot gnu dot org
2006-01-05 22:42 ` pinskia at gcc dot gnu dot org
2006-01-07 16:01 ` [Bug c/25682] [4.0/4.1/4.2 Regression] ICE when using old sytle offsetof (with non zero start) " pinskia at gcc dot gnu dot org
2006-01-14 6:04 ` pinskia at gcc dot gnu dot org
2006-01-15 22:27 ` mmitchel at gcc dot gnu dot org
2006-01-16 12:46 ` jakub at gcc dot gnu dot org
2006-01-16 19:28 ` janis at gcc dot gnu dot org
2006-01-17 9:58 ` jakub at gcc dot gnu dot org
2006-01-17 10:00 ` jakub at gcc dot gnu dot org
2006-02-27 20:25 ` [Bug c/25682] [4.0 " mmitchel at gcc dot gnu dot org
2006-02-28 11:38 ` jakub at gcc dot gnu dot org
2006-02-28 12:45 ` pinskia at gcc dot gnu dot org
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).