public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/28865]  New: Structures with a flexible arrray member have wrong .size
@ 2006-08-27 21:53 qrczak at knm dot org dot pl
  2006-08-27 22:15 ` [Bug middle-end/28865] " qrczak at knm dot org dot pl
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: qrczak at knm dot org dot pl @ 2006-08-27 21:53 UTC (permalink / raw)
  To: gcc-bugs

For example this C:
struct {int x; int y[];} obj = {1, {2, 3}};

produces this assembly:

.globl obj
        .data
        .align 4
        .type   obj, @object
        .size   obj, 4
obj:
        .long   1
        .long   2
        .long   3

.size should include the flexible array component.


-- 
           Summary: Structures with a flexible arrray member have wrong
                    .size
           Product: gcc
           Version: 4.2.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: qrczak at knm dot org dot pl
 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=28865


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [Bug middle-end/28865] Structures with a flexible arrray member have wrong .size
  2006-08-27 21:53 [Bug c/28865] New: Structures with a flexible arrray member have wrong .size qrczak at knm dot org dot pl
@ 2006-08-27 22:15 ` qrczak at knm dot org dot pl
  2006-08-28  3:08 ` pinskia at gcc dot gnu dot org
  2007-12-03 23:42 ` lauro dot venancio at gmail dot com
  2 siblings, 0 replies; 4+ messages in thread
From: qrczak at knm dot org dot pl @ 2006-08-27 22:15 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #1 from qrczak at knm dot org dot pl  2006-08-27 22:15 -------
A question: when this is fixed, what should be C-level sizeof obj?

I hope it would include the flexible array component. This would allow to
detect in autoconf whether this bug is fixed, and would be consistent with
toplevel arrays whose sizes are derived from their initializer.


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=28865


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [Bug middle-end/28865] Structures with a flexible arrray member have wrong .size
  2006-08-27 21:53 [Bug c/28865] New: Structures with a flexible arrray member have wrong .size qrczak at knm dot org dot pl
  2006-08-27 22:15 ` [Bug middle-end/28865] " qrczak at knm dot org dot pl
@ 2006-08-28  3:08 ` pinskia at gcc dot gnu dot org
  2007-12-03 23:42 ` lauro dot venancio at gmail dot com
  2 siblings, 0 replies; 4+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2006-08-28  3:08 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #2 from pinskia at gcc dot gnu dot org  2006-08-28 03:08 -------
Confirmed, not a regression.


-- 

pinskia at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
     Ever Confirmed|0                           |1
  GCC build triplet|i686-pc-linux-gnu           |
   GCC host triplet|i686-pc-linux-gnu           |
 GCC target triplet|i686-pc-linux-gnu           |
      Known to fail|                            |3.0.4 4.0.0 4.1.0 4.2.0
                   |                            |3.3.3 3.2.3 3.4.0
   Last reconfirmed|0000-00-00 00:00:00         |2006-08-28 03:08:51
               date|                            |


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=28865


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [Bug middle-end/28865] Structures with a flexible arrray member have wrong .size
  2006-08-27 21:53 [Bug c/28865] New: Structures with a flexible arrray member have wrong .size qrczak at knm dot org dot pl
  2006-08-27 22:15 ` [Bug middle-end/28865] " qrczak at knm dot org dot pl
  2006-08-28  3:08 ` pinskia at gcc dot gnu dot org
@ 2007-12-03 23:42 ` lauro dot venancio at gmail dot com
  2 siblings, 0 replies; 4+ messages in thread
From: lauro dot venancio at gmail dot com @ 2007-12-03 23:42 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #3 from lauro dot venancio at gmail dot com  2007-12-03 23:42 -------
I think I'm facing a related problem. GCC is emitting unaligned array elements. 

struct ccstm {
        int32_t val;
        const char descr[];
};

static const struct ccstm canon_d30custom[] = {
  { 1, "Long exposure noise reduction" },
  { 2, "Shutter/AE lock buttons" },
  { 3, "Mirror lockup" }
};

produces this assembly for arm-linux-gnueabi:

.align 2
canon_d30custom:
.word 1
.ascii "Long exposure noise reduction\000"
.word 2
.ascii "Shutter/AE lock buttons\000"
.word 3
.ascii "Mirror lockup\000"

Note that the second and the third array element are unaligned.


-- 

lauro dot venancio at gmail dot com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |lauro dot venancio at gmail
                   |                            |dot com


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=28865


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2007-12-03 23:42 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-08-27 21:53 [Bug c/28865] New: Structures with a flexible arrray member have wrong .size qrczak at knm dot org dot pl
2006-08-27 22:15 ` [Bug middle-end/28865] " qrczak at knm dot org dot pl
2006-08-28  3:08 ` pinskia at gcc dot gnu dot org
2007-12-03 23:42 ` lauro dot venancio at gmail dot com

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).