public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/25805] New: Incorrect handling of zero-initialized flexible arrays
@ 2006-01-16 10:19 rsandifo at gcc dot gnu dot org
2006-01-16 10:19 ` [Bug c/25805] " rsandifo at gcc dot gnu dot org
` (6 more replies)
0 siblings, 7 replies; 8+ messages in thread
From: rsandifo at gcc dot gnu dot org @ 2006-01-16 10:19 UTC (permalink / raw)
To: gcc-bugs
A GNU C extension allows you to initialise a flexible array field.
However, if you do this, the DECL_SIZE of the containing object does not
account for the size of the initialised array. DECL_SIZE is simply
CHAR_BIT * sizeof (the structure type). Thus if you have:
struct { int a; int x[]; } d1 = { 0, 0 };
and if -fzero-initialized-in-bss is in effect, we will only allocate
one int for d1, not two:
d1:
.zero 4
A simple executable testcase is:
-------------------------------------------------
struct { int a; int x[]; } d1 = { 0, 0 };
int d2 = 0;
int main ()
{
d2 = 1;
if (d1.x[0] != 0)
abort ();
exit (0);
}
-------------------------------------------------
The testcase passes if compiled with -fno-zero-initialized-in-bss.
--
Summary: Incorrect handling of zero-initialized flexible arrays
Product: gcc
Version: 4.2.0
Status: UNCONFIRMED
Keywords: wrong-code
Severity: normal
Priority: P3
Component: c
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: rsandifo at gcc dot gnu dot org
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=25805
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug c/25805] Incorrect handling of zero-initialized flexible arrays
2006-01-16 10:19 [Bug c/25805] New: Incorrect handling of zero-initialized flexible arrays rsandifo at gcc dot gnu dot org
@ 2006-01-16 10:19 ` rsandifo at gcc dot gnu dot org
2006-01-16 15:54 ` [Bug c/25805] [3.4/4.0/4.1/4.2 Regression] " pinskia at gcc dot gnu dot org
` (5 subsequent siblings)
6 siblings, 0 replies; 8+ messages in thread
From: rsandifo at gcc dot gnu dot org @ 2006-01-16 10:19 UTC (permalink / raw)
To: gcc-bugs
------- Comment #1 from rsandifo at gcc dot gnu dot org 2006-01-16 10:19 -------
Testing a fix
--
rsandifo at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
AssignedTo|unassigned at gcc dot gnu |rsandifo at gcc dot gnu dot
|dot org |org
Status|UNCONFIRMED |ASSIGNED
Ever Confirmed|0 |1
Last reconfirmed|0000-00-00 00:00:00 |2006-01-16 10:19:50
date| |
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=25805
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug c/25805] [3.4/4.0/4.1/4.2 Regression] Incorrect handling of zero-initialized flexible arrays
2006-01-16 10:19 [Bug c/25805] New: Incorrect handling of zero-initialized flexible arrays rsandifo at gcc dot gnu dot org
2006-01-16 10:19 ` [Bug c/25805] " rsandifo at gcc dot gnu dot org
@ 2006-01-16 15:54 ` pinskia at gcc dot gnu dot org
2006-01-19 7:45 ` rsandifo at gcc dot gnu dot org
` (4 subsequent siblings)
6 siblings, 0 replies; 8+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2006-01-16 15:54 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
Known to fail| |4.1.0 4.0.0 3.3.3 3.4.0
| |4.2.0
Known to work| |3.2.3
Summary|Incorrect handling of zero- |[3.4/4.0/4.1/4.2 Regression]
|initialized flexible arrays |Incorrect handling of zero-
| |initialized flexible arrays
Target Milestone|--- |4.0.3
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=25805
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug c/25805] [3.4/4.0/4.1/4.2 Regression] Incorrect handling of zero-initialized flexible arrays
2006-01-16 10:19 [Bug c/25805] New: Incorrect handling of zero-initialized flexible arrays rsandifo at gcc dot gnu dot org
2006-01-16 10:19 ` [Bug c/25805] " rsandifo at gcc dot gnu dot org
2006-01-16 15:54 ` [Bug c/25805] [3.4/4.0/4.1/4.2 Regression] " pinskia at gcc dot gnu dot org
@ 2006-01-19 7:45 ` rsandifo at gcc dot gnu dot org
2006-01-19 7:46 ` rsandifo at gcc dot gnu dot org
` (3 subsequent siblings)
6 siblings, 0 replies; 8+ messages in thread
From: rsandifo at gcc dot gnu dot org @ 2006-01-19 7:45 UTC (permalink / raw)
To: gcc-bugs
------- Comment #2 from rsandifo at gcc dot gnu dot org 2006-01-19 07:45 -------
Subject: Bug 25805
Author: rsandifo
Revision: 109947
Modified property: svn:log
Modified: svn:log at Thu Jan 19 07:45:28 2006
------------------------------------------------------------------------------
--- svn:log (original)
+++ svn:log Thu Jan 19 07:45:28 2006
@@ -1,1 +1,7 @@
-/home/richard/patches/wip/flex-array-init-size.clog
+ PR c/25805
+ * c-decl.c (add_flexible_array_elts_to_size): New function.
+ (finish_decl): Use it.
+
+testsuite/
+ PR c/25805
+ * gcc.dg/pr25805.c: New file.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=25805
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug c/25805] [3.4/4.0/4.1/4.2 Regression] Incorrect handling of zero-initialized flexible arrays
2006-01-16 10:19 [Bug c/25805] New: Incorrect handling of zero-initialized flexible arrays rsandifo at gcc dot gnu dot org
` (2 preceding siblings ...)
2006-01-19 7:45 ` rsandifo at gcc dot gnu dot org
@ 2006-01-19 7:46 ` rsandifo at gcc dot gnu dot org
2006-01-19 7:48 ` [Bug c/25805] [3.4/4.0 " rsandifo at gcc dot gnu dot org
` (2 subsequent siblings)
6 siblings, 0 replies; 8+ messages in thread
From: rsandifo at gcc dot gnu dot org @ 2006-01-19 7:46 UTC (permalink / raw)
To: gcc-bugs
------- Comment #3 from rsandifo at gcc dot gnu dot org 2006-01-19 07:46 -------
Subject: Bug 25805
Author: rsandifo
Revision: 109946
Modified property: svn:log
Modified: svn:log at Thu Jan 19 07:46:15 2006
------------------------------------------------------------------------------
--- svn:log (original)
+++ svn:log Thu Jan 19 07:46:15 2006
@@ -1,1 +1,7 @@
-/home/richard/patches/wip/flex-array-init-size.clog
+ PR c/25805
+ * c-decl.c (add_flexible_array_elts_to_size): New function.
+ (finish_decl): Use it.
+
+testsuite/
+ PR c/25805
+ * gcc.dg/pr25805.c: New file.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=25805
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug c/25805] [3.4/4.0 Regression] Incorrect handling of zero-initialized flexible arrays
2006-01-16 10:19 [Bug c/25805] New: Incorrect handling of zero-initialized flexible arrays rsandifo at gcc dot gnu dot org
` (3 preceding siblings ...)
2006-01-19 7:46 ` rsandifo at gcc dot gnu dot org
@ 2006-01-19 7:48 ` rsandifo at gcc dot gnu dot org
2006-02-27 20:25 ` mmitchel at gcc dot gnu dot org
2006-03-11 3:19 ` mmitchel at gcc dot gnu dot org
6 siblings, 0 replies; 8+ messages in thread
From: rsandifo at gcc dot gnu dot org @ 2006-01-19 7:48 UTC (permalink / raw)
To: gcc-bugs
------- Comment #4 from rsandifo at gcc dot gnu dot org 2006-01-19 07:48 -------
I've checked in the fix for 4.1 and 4.2. It doesn't apply directly
to earlier branches because they used TREE_LISTs for CONSTRUCTORs.
A straight-forward conversion would introduce a linear walk over
the list, which is probably not acceptable. I'm leaving this is
a 3.4 and 4.0 regression for now.
(The original commit wasn't added to bugzilla because I used
-m rather than -F to specify the log message. Ooops. Now fixed
with svn propset.)
--
rsandifo at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |rsandifo at gcc dot gnu dot
| |org
AssignedTo|rsandifo at gcc dot gnu dot |unassigned at gcc dot gnu
|org |dot org
Status|ASSIGNED |NEW
Known to fail|4.1.0 4.0.0 3.3.3 3.4.0 |4.0.0 3.3.3 3.4.0
|4.2.0 |
Known to work|3.2.3 |3.2.3 4.1.0 4.2.0
Summary|[3.4/4.0/4.1/4.2 Regression]|[3.4/4.0 Regression]
|Incorrect handling of zero- |Incorrect handling of zero-
|initialized flexible arrays |initialized flexible arrays
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=25805
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug c/25805] [3.4/4.0 Regression] Incorrect handling of zero-initialized flexible arrays
2006-01-16 10:19 [Bug c/25805] New: Incorrect handling of zero-initialized flexible arrays rsandifo at gcc dot gnu dot org
` (4 preceding siblings ...)
2006-01-19 7:48 ` [Bug c/25805] [3.4/4.0 " rsandifo at gcc dot gnu dot org
@ 2006-02-27 20:25 ` mmitchel at gcc dot gnu dot org
2006-03-11 3:19 ` mmitchel at gcc dot gnu dot org
6 siblings, 0 replies; 8+ messages in thread
From: mmitchel at gcc dot gnu dot org @ 2006-02-27 20:25 UTC (permalink / raw)
To: gcc-bugs
------- Comment #5 from mmitchel at gcc dot gnu dot org 2006-02-27 20:25 -------
Marked as P2. This is a serious issue for those it affects, but it is indeed a
corner case. Also, since this was broken from 3.3.x forwards, there is
presumably relatively little code using the construct; certainly, for 4.0.x,
this bug will not be preventing upgrades from previous 4.0.x releases.
--
mmitchel at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
Priority|P3 |P2
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=25805
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug c/25805] [3.4/4.0 Regression] Incorrect handling of zero-initialized flexible arrays
2006-01-16 10:19 [Bug c/25805] New: Incorrect handling of zero-initialized flexible arrays rsandifo at gcc dot gnu dot org
` (5 preceding siblings ...)
2006-02-27 20:25 ` mmitchel at gcc dot gnu dot org
@ 2006-03-11 3:19 ` mmitchel at gcc dot gnu dot org
6 siblings, 0 replies; 8+ messages in thread
From: mmitchel at gcc dot gnu dot org @ 2006-03-11 3:19 UTC (permalink / raw)
To: gcc-bugs
--
mmitchel at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
Target Milestone|4.0.3 |4.0.4
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=25805
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2006-03-11 3:19 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-01-16 10:19 [Bug c/25805] New: Incorrect handling of zero-initialized flexible arrays rsandifo at gcc dot gnu dot org
2006-01-16 10:19 ` [Bug c/25805] " rsandifo at gcc dot gnu dot org
2006-01-16 15:54 ` [Bug c/25805] [3.4/4.0/4.1/4.2 Regression] " pinskia at gcc dot gnu dot org
2006-01-19 7:45 ` rsandifo at gcc dot gnu dot org
2006-01-19 7:46 ` rsandifo at gcc dot gnu dot org
2006-01-19 7:48 ` [Bug c/25805] [3.4/4.0 " rsandifo at gcc dot gnu dot org
2006-02-27 20:25 ` mmitchel at gcc dot gnu dot org
2006-03-11 3:19 ` mmitchel 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).