* [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 #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
` (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 #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
` (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