public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/50565] New: [4.5/4.6/4.7 Regression] initializer element is not computable at load time
@ 2011-09-29 9:25 doko at gcc dot gnu.org
2011-09-29 10:31 ` [Bug middle-end/50565] " rguenth at gcc dot gnu.org
` (8 more replies)
0 siblings, 9 replies; 10+ messages in thread
From: doko at gcc dot gnu.org @ 2011-09-29 9:25 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=50565
Bug #: 50565
Summary: [4.5/4.6/4.7 Regression] initializer element is not
computable at load time
Classification: Unclassified
Product: gcc
Version: 4.6.2
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c
AssignedTo: unassigned@gcc.gnu.org
ReportedBy: doko@gcc.gnu.org
Created attachment 25379
--> http://gcc.gnu.org/bugzilla/attachment.cgi?id=25379
preprocessed source
[forwarded from http://bugs.debian.org/642144]
this may be a duplicate of PR38354, compiles on 32bit targets, on 64bit targets
it succeeds with 4.4, but fails with 4.5, 4.6 and trunk:
$ gcc -c message.i
message.i:154:2: error: initializer element is not computable at load time
message.i:154:2: error: (near initialization for 'byte_order[1].offset')
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug middle-end/50565] [4.5/4.6/4.7 Regression] initializer element is not computable at load time
2011-09-29 9:25 [Bug c/50565] New: [4.5/4.6/4.7 Regression] initializer element is not computable at load time doko at gcc dot gnu.org
@ 2011-09-29 10:31 ` rguenth at gcc dot gnu.org
2011-09-29 17:27 ` pinskia at gcc dot gnu.org
` (7 subsequent siblings)
8 siblings, 0 replies; 10+ messages in thread
From: rguenth at gcc dot gnu.org @ 2011-09-29 10:31 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=50565
Richard Guenther <rguenth at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Component|c |middle-end
Target Milestone|--- |4.5.4
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug middle-end/50565] [4.5/4.6/4.7 Regression] initializer element is not computable at load time
2011-09-29 9:25 [Bug c/50565] New: [4.5/4.6/4.7 Regression] initializer element is not computable at load time doko at gcc dot gnu.org
2011-09-29 10:31 ` [Bug middle-end/50565] " rguenth at gcc dot gnu.org
@ 2011-09-29 17:27 ` pinskia at gcc dot gnu.org
2011-10-01 20:37 ` mikpe at it dot uu.se
` (6 subsequent siblings)
8 siblings, 0 replies; 10+ messages in thread
From: pinskia at gcc dot gnu.org @ 2011-09-29 17:27 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=50565
--- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> 2011-09-29 17:03:28 UTC ---
Anyreason Why "((int)( ((void *)&(nmsgbuf.payload.part.ball.pos[0])) - ((void
*)&(nmsgbuf)) ))" is being used instead of offsetof ?
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug middle-end/50565] [4.5/4.6/4.7 Regression] initializer element is not computable at load time
2011-09-29 9:25 [Bug c/50565] New: [4.5/4.6/4.7 Regression] initializer element is not computable at load time doko at gcc dot gnu.org
2011-09-29 10:31 ` [Bug middle-end/50565] " rguenth at gcc dot gnu.org
2011-09-29 17:27 ` pinskia at gcc dot gnu.org
@ 2011-10-01 20:37 ` mikpe at it dot uu.se
2011-10-02 10:44 ` mikpe at it dot uu.se
` (5 subsequent siblings)
8 siblings, 0 replies; 10+ messages in thread
From: mikpe at it dot uu.se @ 2011-10-01 20:37 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=50565
Mikael Pettersson <mikpe at it dot uu.se> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |mikpe at it dot uu.se
--- Comment #2 from Mikael Pettersson <mikpe at it dot uu.se> 2011-10-01 20:36:57 UTC ---
This test case started being rejected with r145254:
http://gcc.gnu.org/ml/gcc-cvs/2009-03/msg00761.html
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug middle-end/50565] [4.5/4.6/4.7 Regression] initializer element is not computable at load time
2011-09-29 9:25 [Bug c/50565] New: [4.5/4.6/4.7 Regression] initializer element is not computable at load time doko at gcc dot gnu.org
` (2 preceding siblings ...)
2011-10-01 20:37 ` mikpe at it dot uu.se
@ 2011-10-02 10:44 ` mikpe at it dot uu.se
2011-10-11 15:34 ` [Bug c/50565] " jsm28 at gcc dot gnu.org
` (4 subsequent siblings)
8 siblings, 0 replies; 10+ messages in thread
From: mikpe at it dot uu.se @ 2011-10-02 10:44 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=50565
--- Comment #3 from Mikael Pettersson <mikpe at it dot uu.se> 2011-10-02 10:43:54 UTC ---
Created attachment 25393
--> http://gcc.gnu.org/bugzilla/attachment.cgi?id=25393
reduced test case
> cat pr50565.c
/* pr50565.c */
struct netmessage {
unsigned char pos[2];
};
static struct netmessage nmsgbuf;
const int offset0 = (int)((void*)&nmsgbuf.pos[0] - (void*)&nmsgbuf) + 0*(1U);
const int offset1 = (int)((void*)&nmsgbuf.pos[0] - (void*)&nmsgbuf) + 1*(1U);
> objdir/gcc/xgcc -Bobjdir/gcc/ -O2 -S pr50565.c
pr50565.c:7: error: initializer element is not computable at load time
That's the offset1 initializer it's complaining about. Note that the offset0
initializer is accepted. If we comment out the offset1 definition we get:
> perl -pi -e 's,^const int offset1,//const int offset1,g' pr50565.c
> objdir/gcc/xgcc -Bobjdir/gcc/ -O2 -S pr50565.c
> cat pr50565.s
.file "pr50565.c"
.globl offset0
.section .rodata
.align 4
.type offset0, @object
.size offset0, 4
offset0:
.long 0
.local nmsgbuf
.comm nmsgbuf,2,1
.ident "GCC: (GNU) 4.5.0 20090329 (experimental)"
.section .note.GNU-stack,"",@progbits
The common offsetof emulation is clearly computable at compile-time, so one
would expect the same + 1 to also be computable at compile-time, but gcc
doesn't seem to think so.
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug c/50565] [4.5/4.6/4.7 Regression] initializer element is not computable at load time
2011-09-29 9:25 [Bug c/50565] New: [4.5/4.6/4.7 Regression] initializer element is not computable at load time doko at gcc dot gnu.org
` (3 preceding siblings ...)
2011-10-02 10:44 ` mikpe at it dot uu.se
@ 2011-10-11 15:34 ` jsm28 at gcc dot gnu.org
2011-10-12 11:57 ` jsm28 at gcc dot gnu.org
` (3 subsequent siblings)
8 siblings, 0 replies; 10+ messages in thread
From: jsm28 at gcc dot gnu.org @ 2011-10-11 15:34 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=50565
Joseph S. Myers <jsm28 at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |ASSIGNED
Last reconfirmed| |2011-10-11
AssignedTo|unassigned at gcc dot |jsm28 at gcc dot gnu.org
|gnu.org |
Ever Confirmed|0 |1
--- Comment #4 from Joseph S. Myers <jsm28 at gcc dot gnu.org> 2011-10-11 15:33:55 UTC ---
Patch (to convert.c) submitted:
http://gcc.gnu.org/ml/gcc-patches/2011-10/msg00894.html
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug c/50565] [4.5/4.6/4.7 Regression] initializer element is not computable at load time
2011-09-29 9:25 [Bug c/50565] New: [4.5/4.6/4.7 Regression] initializer element is not computable at load time doko at gcc dot gnu.org
` (4 preceding siblings ...)
2011-10-11 15:34 ` [Bug c/50565] " jsm28 at gcc dot gnu.org
@ 2011-10-12 11:57 ` jsm28 at gcc dot gnu.org
2011-10-12 11:57 ` jsm28 at gcc dot gnu.org
` (2 subsequent siblings)
8 siblings, 0 replies; 10+ messages in thread
From: jsm28 at gcc dot gnu.org @ 2011-10-12 11:57 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=50565
--- Comment #6 from Joseph S. Myers <jsm28 at gcc dot gnu.org> 2011-10-12 11:57:39 UTC ---
Author: jsm28
Date: Wed Oct 12 11:57:36 2011
New Revision: 179846
URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=179846
Log:
PR c/50565
* convert.c (convert_to_integer): Do not narrow operands of
pointer subtraction.
testsuite:
* gcc.c-torture/compile/pr50565-1.c,
gcc.c-torture/compile/pr50565-2.c: New tests.
Added:
branches/gcc-4_6-branch/gcc/testsuite/gcc.c-torture/compile/pr50565-1.c
branches/gcc-4_6-branch/gcc/testsuite/gcc.c-torture/compile/pr50565-2.c
Modified:
branches/gcc-4_6-branch/gcc/ChangeLog
branches/gcc-4_6-branch/gcc/convert.c
branches/gcc-4_6-branch/gcc/testsuite/ChangeLog
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug c/50565] [4.5/4.6/4.7 Regression] initializer element is not computable at load time
2011-09-29 9:25 [Bug c/50565] New: [4.5/4.6/4.7 Regression] initializer element is not computable at load time doko at gcc dot gnu.org
` (5 preceding siblings ...)
2011-10-12 11:57 ` jsm28 at gcc dot gnu.org
@ 2011-10-12 11:57 ` jsm28 at gcc dot gnu.org
2011-10-12 11:59 ` jsm28 at gcc dot gnu.org
2011-10-12 12:01 ` jsm28 at gcc dot gnu.org
8 siblings, 0 replies; 10+ messages in thread
From: jsm28 at gcc dot gnu.org @ 2011-10-12 11:57 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=50565
--- Comment #5 from Joseph S. Myers <jsm28 at gcc dot gnu.org> 2011-10-12 11:56:06 UTC ---
Author: jsm28
Date: Wed Oct 12 11:56:03 2011
New Revision: 179845
URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=179845
Log:
PR c/50565
* convert.c (convert_to_integer): Do not narrow operands of
pointer subtraction.
testsuite:
* gcc.c-torture/compile/pr50565-1.c,
gcc.c-torture/compile/pr50565-2.c: New tests.
Added:
trunk/gcc/testsuite/gcc.c-torture/compile/pr50565-1.c
trunk/gcc/testsuite/gcc.c-torture/compile/pr50565-2.c
Modified:
trunk/gcc/ChangeLog
trunk/gcc/convert.c
trunk/gcc/testsuite/ChangeLog
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug c/50565] [4.5/4.6/4.7 Regression] initializer element is not computable at load time
2011-09-29 9:25 [Bug c/50565] New: [4.5/4.6/4.7 Regression] initializer element is not computable at load time doko at gcc dot gnu.org
` (6 preceding siblings ...)
2011-10-12 11:57 ` jsm28 at gcc dot gnu.org
@ 2011-10-12 11:59 ` jsm28 at gcc dot gnu.org
2011-10-12 12:01 ` jsm28 at gcc dot gnu.org
8 siblings, 0 replies; 10+ messages in thread
From: jsm28 at gcc dot gnu.org @ 2011-10-12 11:59 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=50565
--- Comment #7 from Joseph S. Myers <jsm28 at gcc dot gnu.org> 2011-10-12 11:58:52 UTC ---
Author: jsm28
Date: Wed Oct 12 11:58:47 2011
New Revision: 179847
URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=179847
Log:
PR c/50565
* convert.c (convert_to_integer): Do not narrow operands of
pointer subtraction.
testsuite:
* gcc.c-torture/compile/pr50565-1.c,
gcc.c-torture/compile/pr50565-2.c: New tests.
Added:
branches/gcc-4_5-branch/gcc/testsuite/gcc.c-torture/compile/pr50565-1.c
branches/gcc-4_5-branch/gcc/testsuite/gcc.c-torture/compile/pr50565-2.c
Modified:
branches/gcc-4_5-branch/gcc/ChangeLog
branches/gcc-4_5-branch/gcc/convert.c
branches/gcc-4_5-branch/gcc/testsuite/ChangeLog
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug c/50565] [4.5/4.6/4.7 Regression] initializer element is not computable at load time
2011-09-29 9:25 [Bug c/50565] New: [4.5/4.6/4.7 Regression] initializer element is not computable at load time doko at gcc dot gnu.org
` (7 preceding siblings ...)
2011-10-12 11:59 ` jsm28 at gcc dot gnu.org
@ 2011-10-12 12:01 ` jsm28 at gcc dot gnu.org
8 siblings, 0 replies; 10+ messages in thread
From: jsm28 at gcc dot gnu.org @ 2011-10-12 12:01 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=50565
Joseph S. Myers <jsm28 at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|ASSIGNED |RESOLVED
Resolution| |FIXED
--- Comment #8 from Joseph S. Myers <jsm28 at gcc dot gnu.org> 2011-10-12 12:00:02 UTC ---
Fixed for 4.5.4, 4.6.2, 4.7.
^ permalink raw reply [flat|nested] 10+ messages in thread
end of thread, other threads:[~2011-10-12 12:01 UTC | newest]
Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-09-29 9:25 [Bug c/50565] New: [4.5/4.6/4.7 Regression] initializer element is not computable at load time doko at gcc dot gnu.org
2011-09-29 10:31 ` [Bug middle-end/50565] " rguenth at gcc dot gnu.org
2011-09-29 17:27 ` pinskia at gcc dot gnu.org
2011-10-01 20:37 ` mikpe at it dot uu.se
2011-10-02 10:44 ` mikpe at it dot uu.se
2011-10-11 15:34 ` [Bug c/50565] " jsm28 at gcc dot gnu.org
2011-10-12 11:57 ` jsm28 at gcc dot gnu.org
2011-10-12 11:57 ` jsm28 at gcc dot gnu.org
2011-10-12 11:59 ` jsm28 at gcc dot gnu.org
2011-10-12 12:01 ` jsm28 at gcc dot gnu.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).