public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug middle-end/61848] New: a previous declaration causes the section attribute to be lost
@ 2014-07-19  4:02 pinskia at gcc dot gnu.org
  2014-07-19  4:03 ` [Bug middle-end/61848] [4.10 Regression] " pinskia at gcc dot gnu.org
                   ` (22 more replies)
  0 siblings, 23 replies; 24+ messages in thread
From: pinskia at gcc dot gnu.org @ 2014-07-19  4:02 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61848

            Bug ID: 61848
           Summary: a previous declaration causes the section attribute to
                    be lost
           Product: gcc
           Version: 4.10.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: middle-end
          Assignee: unassigned at gcc dot gnu.org
          Reporter: pinskia at gcc dot gnu.org

Take:
void f(void);
void __attribute__ ((__section__(".init.text"))) f(void)
{

}
---- CUT ---
The section attribute is lost from the function.
at -O1, -O0, -Og we get:
    .file    "t.c"
    .text
    .globl    f
    .type    f, @function
f:
.LFB0:
    .cfi_startproc
    rep; ret
    .cfi_endproc
.LFE0:
    .size    f, .-f
    .ident    "GCC: (GNU) 4.10.0 20140718 (experimental)"
    .section    .note.GNU-stack,"",@progbits

While at -O2 and above (including -Os), we get:
    .file    "t.c"
    .section    .text.unlikely,"ax",@progbits
.LCOLDB0:
    .text
.LHOTB0:
    .p2align 4,,15
    .globl    f
    .type    f, @function
f:
.LFB0:
    .cfi_startproc
    rep; ret
    .cfi_endproc
.LFE0:
    .size    f, .-f
    .section    .text.unlikely
.LCOLDE0:
    .text
.LHOTE0:
    .ident    "GCC: (GNU) 4.10.0 20140718 (experimental)"
    .section    .note.GNU-stack,"",@progbits

Notice how f is no longer in the correct section.
If we comment out the declaration (prototype), we get:
    .file    "t.c"
    .section    .init.text,"ax",@progbits
    .globl    f
    .type    f, @function
f:
.LFB0:
    .cfi_startproc
    rep; ret
    .cfi_endproc
.LFE0:
    .size    f, .-f
    .ident    "GCC: (GNU) 4.10.0 20140718 (experimental)"
    .section    .note.GNU-stack,"",@progbits


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

end of thread, other threads:[~2014-10-17  5:23 UTC | newest]

Thread overview: 24+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-07-19  4:02 [Bug middle-end/61848] New: a previous declaration causes the section attribute to be lost pinskia at gcc dot gnu.org
2014-07-19  4:03 ` [Bug middle-end/61848] [4.10 Regression] " pinskia at gcc dot gnu.org
2014-07-19  5:49 ` pinskia at gcc dot gnu.org
2014-07-19  5:52 ` pinskia at gcc dot gnu.org
2014-07-19  6:01 ` pinskia at gcc dot gnu.org
2014-07-19  6:15 ` pinskia at gcc dot gnu.org
2014-07-19  6:20 ` pinskia at gcc dot gnu.org
2014-08-12 16:20 ` pinskia at gcc dot gnu.org
2014-09-03  6:39 ` [Bug middle-end/61848] [5 " ryabinin.a.a at gmail dot com
2014-09-11  1:14 ` pinskia at gcc dot gnu.org
2014-09-12 14:57 ` amodra at gmail dot com
2014-09-12 23:26 ` amodra at gmail dot com
2014-09-12 23:44 ` amodra at gmail dot com
2014-09-18 16:49 ` sasha.levin at oracle dot com
2014-09-23 15:18 ` pinskia at gcc dot gnu.org
2014-09-26 14:58 ` andi-gcc at firstfloor dot org
2014-09-28 18:00 ` andi-gcc at firstfloor dot org
2014-09-28 18:12 ` pinskia at gcc dot gnu.org
2014-09-28 18:14 ` trippels at gcc dot gnu.org
2014-09-28 18:18 ` trippels at gcc dot gnu.org
2014-09-28 18:30 ` andi-gcc at firstfloor dot org
2014-10-16  4:52 ` amodra at gmail dot com
2014-10-17  5:10 ` trippels at gcc dot gnu.org
2014-10-17  5:23 ` trippels 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).