public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "anmol at freescale dot com" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug c/39383] sizeof object with zero-length array ignores initializer
Date: Fri, 17 Apr 2009 22:39:00 -0000	[thread overview]
Message-ID: <20090417223929.26482.qmail@sourceware.org> (raw)
In-Reply-To: <bug-39383-1535@http.gcc.gnu.org/bugzilla/>



------- Comment #10 from anmol at freescale dot com  2009-04-17 22:39 -------
I am working on this problem and see that for generic ELF OS's,
defining ASM_DECLARE_OBJECT_NAME (gcc/config/elfos.h) to use the
size of the initializer (as against the size of the type) to emit
the true size in the .size directive results in the following code
being emitted for the submitted example:

        .type   f1, @object
        .size   f1, 16
f1:
        .long   1
        .long   2
        .long   3
        .long   4
        .section        .rodata

I am currently regression testing my fix (and plan
on submitting the patch for the generic ELF OS case
(assuming that this is the right approach to take
here)).

However, I am not sure if the same change will be
needed in ASM_FINISH_DECLARE_OBJECT as well? 
rest_of_decl_compilation in gcc/passes.c seems to
suggest that this macro is used for tentative
definitions - in which case there would be no 
initializer and that seems to suggest that no change
would be needed (using the size of the type would
be the right thing to do). But in the GCC Internals
Manual, Ch. 17 Sec. 17.21.4 Output and Generation of
Labels - the description suggests that a change is
needed in this macro as well. (Kindly advise, and I
shall incorporate).

Thank you.


-- 


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


  parent reply	other threads:[~2009-04-17 22:39 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-03-05 12:39 [Bug c/39383] New: " algrant at acm dot org
2009-03-05 13:06 ` [Bug c/39383] " ebotcazou at gcc dot gnu dot org
2009-03-05 13:19 ` algrant at acm dot org
2009-03-05 13:31 ` ebotcazou at gcc dot gnu dot org
2009-03-05 13:53 ` joseph at codesourcery dot com
2009-03-05 14:48 ` algrant at acm dot org
2009-03-06 14:45 ` algrant at acm dot org
2009-03-06 17:27 ` jsm28 at gcc dot gnu dot org
2009-04-08 21:36 ` b07584 at freescale dot com
2009-04-08 22:54 ` joseph at codesourcery dot com
2009-04-17 22:39 ` anmol at freescale dot com [this message]
2009-04-23 15:53 ` anmol at freescale dot com

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20090417223929.26482.qmail@sourceware.org \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).