public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug middle-end/59719] New: Too much space allocated to unions containing variable length arrays
@ 2014-01-08 12:01 nickc at gcc dot gnu.org
  2014-01-08 12:44 ` [Bug middle-end/59719] " mikpelinux at gmail dot com
  2014-01-09 20:09 ` jakub at gcc dot gnu.org
  0 siblings, 2 replies; 3+ messages in thread
From: nickc at gcc dot gnu.org @ 2014-01-08 12:01 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 59719
           Summary: Too much space allocated to unions containing variable
                    length arrays
           Product: gcc
           Version: 4.9.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: middle-end
          Assignee: unassigned at gcc dot gnu.org
          Reporter: nickc at gcc dot gnu.org

Created attachment 31771
  --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=31771&action=edit
test case to demonstrate the problem - effective on targets which use section
anchors

When gcc emits assembler directives to describe a union containing a variable
length array it tries to ensure that the end of the union is correctly aligned,
but it ends up emitting an incorrectly sized .zero pseudo-op. 

For example in the uploaded testcase, when compiled with an x86 toolchain, the
variable first_var_union is described in the assembler output as:

        .type   first_var_union, @object
        .size   first_var_union, 20
  first_var_union:
        .zero   4
        .string "12-octet-str"
        .zero   16

Note how the size of the variable is set to 20, but the actual size is
4+13+16=33 bytes.  Presumably the second .zero directive should have been
".zero 3".

This might just be a curiosity were it not for the fact that it makes any
following variables unaligned (unless the size of the union just happens to fir
into an alignment category).  Plus for targets which use section anchors (eg
aarch64, arm, ppc, mips), the computation of the offset to variables beyond the
variable length union will be based upon the expected size (20) not the real
size (33).


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

* [Bug middle-end/59719] Too much space allocated to unions containing variable length arrays
  2014-01-08 12:01 [Bug middle-end/59719] New: Too much space allocated to unions containing variable length arrays nickc at gcc dot gnu.org
@ 2014-01-08 12:44 ` mikpelinux at gmail dot com
  2014-01-09 20:09 ` jakub at gcc dot gnu.org
  1 sibling, 0 replies; 3+ messages in thread
From: mikpelinux at gmail dot com @ 2014-01-08 12:44 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #1 from Mikael Pettersson <mikpelinux at gmail dot com> ---
Related to / dup of PR28865 and PR57180 ?


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

* [Bug middle-end/59719] Too much space allocated to unions containing variable length arrays
  2014-01-08 12:01 [Bug middle-end/59719] New: Too much space allocated to unions containing variable length arrays nickc at gcc dot gnu.org
  2014-01-08 12:44 ` [Bug middle-end/59719] " mikpelinux at gmail dot com
@ 2014-01-09 20:09 ` jakub at gcc dot gnu.org
  1 sibling, 0 replies; 3+ messages in thread
From: jakub at gcc dot gnu.org @ 2014-01-09 20:09 UTC (permalink / raw)
  To: gcc-bugs

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

Jakub Jelinek <jakub at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
                 CC|                            |jakub at gcc dot gnu.org
         Resolution|---                         |DUPLICATE

--- Comment #2 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Dup.

*** This bug has been marked as a duplicate of bug 28865 ***


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

end of thread, other threads:[~2014-01-09 20:09 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-01-08 12:01 [Bug middle-end/59719] New: Too much space allocated to unions containing variable length arrays nickc at gcc dot gnu.org
2014-01-08 12:44 ` [Bug middle-end/59719] " mikpelinux at gmail dot com
2014-01-09 20:09 ` jakub 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).