public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug target/64417] New: [SH] FAIL: gcc.c-torture/compile/pr28865.c -O0 (test for excess errors)
@ 2014-12-27 11:24 olegendo at gcc dot gnu.org
2014-12-27 13:03 ` [Bug c/64417] " schwab@linux-m68k.org
` (6 more replies)
0 siblings, 7 replies; 8+ messages in thread
From: olegendo at gcc dot gnu.org @ 2014-12-27 11:24 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64417
Bug ID: 64417
Summary: [SH] FAIL: gcc.c-torture/compile/pr28865.c -O0
(test for excess errors)
Product: gcc
Version: 5.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: target
Assignee: unassigned at gcc dot gnu.org
Reporter: olegendo at gcc dot gnu.org
On SH, the test case
struct var_len
{
int field1;
const char field2[];
};
static const struct var_len var_array[] =
{
{ 1, "Long exposure noise reduction" },
{ 2, "Shutter/AE lock buttons" },
{ 3, "Mirror lockup" }
};
without optimization compiles to:
.little
.section .rodata
.align 2
.type _var_array, @object
.size _var_array, 12
_var_array:
.long 1
.string "Long exposure noise reduction"
.long 2
.string "Shutter/AE lock buttons"
.long 3
.string "Mirror lockup"
.ident "GCC: (GNU) 5.0.0 20141226 (experimental)"
The structs in the array are misaligned. Either the struct size has to be
aligned to 4 bytes (adding '\0' chars to the strings or inserting .align 2) or
the 32 bit values have to be output as byte arrays.
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug c/64417] [SH] FAIL: gcc.c-torture/compile/pr28865.c -O0 (test for excess errors)
2014-12-27 11:24 [Bug target/64417] New: [SH] FAIL: gcc.c-torture/compile/pr28865.c -O0 (test for excess errors) olegendo at gcc dot gnu.org
@ 2014-12-27 13:03 ` schwab@linux-m68k.org
2015-01-05 13:57 ` mpolacek at gcc dot gnu.org
` (5 subsequent siblings)
6 siblings, 0 replies; 8+ messages in thread
From: schwab@linux-m68k.org @ 2014-12-27 13:03 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64417
Andreas Schwab <schwab@linux-m68k.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Component|target |c
--- Comment #1 from Andreas Schwab <schwab@linux-m68k.org> ---
That should be rejected, since array element types may not be incomplete.
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug c/64417] [SH] FAIL: gcc.c-torture/compile/pr28865.c -O0 (test for excess errors)
2014-12-27 11:24 [Bug target/64417] New: [SH] FAIL: gcc.c-torture/compile/pr28865.c -O0 (test for excess errors) olegendo at gcc dot gnu.org
2014-12-27 13:03 ` [Bug c/64417] " schwab@linux-m68k.org
@ 2015-01-05 13:57 ` mpolacek at gcc dot gnu.org
2015-01-05 17:54 ` mpolacek at gcc dot gnu.org
` (4 subsequent siblings)
6 siblings, 0 replies; 8+ messages in thread
From: mpolacek at gcc dot gnu.org @ 2015-01-05 13:57 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64417
Marek Polacek <mpolacek at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |mpolacek at gcc dot gnu.org
--- Comment #2 from Marek Polacek <mpolacek at gcc dot gnu.org> ---
I tend to agree. In other words,
struct foo { int x; char y[]; };
struct foo a1[] = { { 1, "a" } };
struct foo a2[] = { { 1, { "a" } } };
struct foo a3[] = { 1, "a" };
struct foo b1[] = { { 1, { 'a', '\0' } } };
struct foo b2[] = { 1, { 'a', '\0' } };
We reject b1 and b2, but should also reject a[123].
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug c/64417] [SH] FAIL: gcc.c-torture/compile/pr28865.c -O0 (test for excess errors)
2014-12-27 11:24 [Bug target/64417] New: [SH] FAIL: gcc.c-torture/compile/pr28865.c -O0 (test for excess errors) olegendo at gcc dot gnu.org
2014-12-27 13:03 ` [Bug c/64417] " schwab@linux-m68k.org
2015-01-05 13:57 ` mpolacek at gcc dot gnu.org
@ 2015-01-05 17:54 ` mpolacek at gcc dot gnu.org
2015-01-05 21:03 ` schwab@linux-m68k.org
` (3 subsequent siblings)
6 siblings, 0 replies; 8+ messages in thread
From: mpolacek at gcc dot gnu.org @ 2015-01-05 17:54 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64417
--- Comment #3 from Marek Polacek <mpolacek at gcc dot gnu.org> ---
I have a patch for rejecting such code, but the question is if it is desirable
to not accept that code, since e.g. glibc used to (?) misuse this feature.
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug c/64417] [SH] FAIL: gcc.c-torture/compile/pr28865.c -O0 (test for excess errors)
2014-12-27 11:24 [Bug target/64417] New: [SH] FAIL: gcc.c-torture/compile/pr28865.c -O0 (test for excess errors) olegendo at gcc dot gnu.org
` (2 preceding siblings ...)
2015-01-05 17:54 ` mpolacek at gcc dot gnu.org
@ 2015-01-05 21:03 ` schwab@linux-m68k.org
2015-01-06 6:22 ` mpolacek at gcc dot gnu.org
` (2 subsequent siblings)
6 siblings, 0 replies; 8+ messages in thread
From: schwab@linux-m68k.org @ 2015-01-05 21:03 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64417
--- Comment #4 from Andreas Schwab <schwab@linux-m68k.org> ---
The glibc sources never contained such an array of incomplete type. The
example in bug28865#c3 has nothing to do with glibc.
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug c/64417] [SH] FAIL: gcc.c-torture/compile/pr28865.c -O0 (test for excess errors)
2014-12-27 11:24 [Bug target/64417] New: [SH] FAIL: gcc.c-torture/compile/pr28865.c -O0 (test for excess errors) olegendo at gcc dot gnu.org
` (3 preceding siblings ...)
2015-01-05 21:03 ` schwab@linux-m68k.org
@ 2015-01-06 6:22 ` mpolacek at gcc dot gnu.org
2015-01-07 8:20 ` mpolacek at gcc dot gnu.org
2015-01-07 8:23 ` mpolacek at gcc dot gnu.org
6 siblings, 0 replies; 8+ messages in thread
From: mpolacek at gcc dot gnu.org @ 2015-01-06 6:22 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64417
Marek Polacek <mpolacek at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |ASSIGNED
Last reconfirmed| |2015-01-06
Assignee|unassigned at gcc dot gnu.org |mpolacek at gcc dot gnu.org
Target Milestone|--- |5.0
Ever confirmed|0 |1
--- Comment #5 from Marek Polacek <mpolacek at gcc dot gnu.org> ---
Great, thanks.
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug c/64417] [SH] FAIL: gcc.c-torture/compile/pr28865.c -O0 (test for excess errors)
2014-12-27 11:24 [Bug target/64417] New: [SH] FAIL: gcc.c-torture/compile/pr28865.c -O0 (test for excess errors) olegendo at gcc dot gnu.org
` (4 preceding siblings ...)
2015-01-06 6:22 ` mpolacek at gcc dot gnu.org
@ 2015-01-07 8:20 ` mpolacek at gcc dot gnu.org
2015-01-07 8:23 ` mpolacek at gcc dot gnu.org
6 siblings, 0 replies; 8+ messages in thread
From: mpolacek at gcc dot gnu.org @ 2015-01-07 8:20 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64417
--- Comment #6 from Marek Polacek <mpolacek at gcc dot gnu.org> ---
Author: mpolacek
Date: Wed Jan 7 08:19:48 2015
New Revision: 219278
URL: https://gcc.gnu.org/viewcvs?rev=219278&root=gcc&view=rev
Log:
PR c/64417
c/
* c-typeck.c (process_init_element): Disallow initialization of
a flexible array member with a string constant if the structure
is in an array.
testsuite/
* gcc.c-torture/compile/pr28865.c: Add dg-errors.
* gcc.dg/pr64417.c: New test.
Added:
trunk/gcc/testsuite/gcc.dg/pr64417.c
Modified:
trunk/gcc/c/ChangeLog
trunk/gcc/c/c-typeck.c
trunk/gcc/testsuite/ChangeLog
trunk/gcc/testsuite/gcc.c-torture/compile/pr28865.c
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug c/64417] [SH] FAIL: gcc.c-torture/compile/pr28865.c -O0 (test for excess errors)
2014-12-27 11:24 [Bug target/64417] New: [SH] FAIL: gcc.c-torture/compile/pr28865.c -O0 (test for excess errors) olegendo at gcc dot gnu.org
` (5 preceding siblings ...)
2015-01-07 8:20 ` mpolacek at gcc dot gnu.org
@ 2015-01-07 8:23 ` mpolacek at gcc dot gnu.org
6 siblings, 0 replies; 8+ messages in thread
From: mpolacek at gcc dot gnu.org @ 2015-01-07 8:23 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64417
Marek Polacek <mpolacek at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|ASSIGNED |RESOLVED
Resolution|--- |FIXED
--- Comment #7 from Marek Polacek <mpolacek at gcc dot gnu.org> ---
Fixed.
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2015-01-07 8:23 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-12-27 11:24 [Bug target/64417] New: [SH] FAIL: gcc.c-torture/compile/pr28865.c -O0 (test for excess errors) olegendo at gcc dot gnu.org
2014-12-27 13:03 ` [Bug c/64417] " schwab@linux-m68k.org
2015-01-05 13:57 ` mpolacek at gcc dot gnu.org
2015-01-05 17:54 ` mpolacek at gcc dot gnu.org
2015-01-05 21:03 ` schwab@linux-m68k.org
2015-01-06 6:22 ` mpolacek at gcc dot gnu.org
2015-01-07 8:20 ` mpolacek at gcc dot gnu.org
2015-01-07 8:23 ` mpolacek 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).