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

* [Bug middle-end/61848] [4.10 Regression] a previous declaration causes the section attribute to be lost
  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 ` pinskia at gcc dot gnu.org
  2014-07-19  5:49 ` pinskia at gcc dot gnu.org
                   ` (21 subsequent siblings)
  22 siblings, 0 replies; 24+ messages in thread
From: pinskia at gcc dot gnu.org @ 2014-07-19  4:03 UTC (permalink / raw)
  To: gcc-bugs

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

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |wrong-code
   Target Milestone|---                         |4.10.0
            Summary|a previous declaration      |[4.10 Regression] a
                   |causes the section          |previous declaration causes
                   |attribute to be lost        |the section attribute to be
                   |                            |lost
           Severity|normal                      |blocker

--- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
This causes the kernel to output messages like:

WARNING: arch/arm64/mm/built-in.o(.text.unlikely+0x104): Section mismatch in
reference from the function mem_init() to the function
.init.text:arm64_swiotlb_init()
The function mem_init() references
the function __init arm64_swiotlb_init().
This is often because mem_init lacks a __init 
annotation or the annotation of arm64_swiotlb_init is wrong.


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

* [Bug middle-end/61848] [4.10 Regression] a previous declaration causes the section attribute to be lost
  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
                   ` (20 subsequent siblings)
  22 siblings, 0 replies; 24+ messages in thread
From: pinskia at gcc dot gnu.org @ 2014-07-19  5:49 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #2 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Most likely caused by:
https://gcc.gnu.org/git/?p=gcc.git;a=commit;h=738a6bdaaa22a526fae65016127c229d99f377b4

There is this comment in c-decl.c:
      /* Copy the assembler name.
     Currently, it can only be defined in the prototype.  */


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

* [Bug middle-end/61848] [4.10 Regression] a previous declaration causes the section attribute to be lost
  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
                   ` (19 subsequent siblings)
  22 siblings, 0 replies; 24+ messages in thread
From: pinskia at gcc dot gnu.org @ 2014-07-19  5:52 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #3 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
The documentation does not say it has to be only in the declaration:
section ("section-name")
Normally, the compiler places the code it generates in the text section.
Sometimes, however, you need additional sections, or you need certain
particular functions to appear in special sections. The section attribute
specifies that a function lives in a particular section. For example, the
declaration:
          extern void foobar (void) __attribute__ ((section ("bar")));
puts the function foobar in the bar section.

Some file formats do not support arbitrary sections so the section attribute is
not available on all platforms. If you need to map the entire contents of a
module to a particular section, consider using the facilities of the linker
instead.


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

* [Bug middle-end/61848] [4.10 Regression] a previous declaration causes the section attribute to be lost
  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
                   ` (2 preceding siblings ...)
  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
                   ` (18 subsequent siblings)
  22 siblings, 0 replies; 24+ messages in thread
From: pinskia at gcc dot gnu.org @ 2014-07-19  6:01 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #4 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
I think we are merging the decls incorrectly.  We are only merging the section
name one way and both.


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

* [Bug middle-end/61848] [4.10 Regression] a previous declaration causes the section attribute to be lost
  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
                   ` (3 preceding siblings ...)
  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
                   ` (17 subsequent siblings)
  22 siblings, 0 replies; 24+ messages in thread
From: pinskia at gcc dot gnu.org @ 2014-07-19  6:15 UTC (permalink / raw)
  To: gcc-bugs

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

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |ASSIGNED
   Last reconfirmed|                            |2014-07-19
           Assignee|unassigned at gcc dot gnu.org      |pinskia at gcc dot gnu.org
     Ever confirmed|0                           |1

--- Comment #5 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
I have a fix.


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

* [Bug middle-end/61848] [4.10 Regression] a previous declaration causes the section attribute to be lost
  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
                   ` (4 preceding siblings ...)
  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
                   ` (16 subsequent siblings)
  22 siblings, 0 replies; 24+ messages in thread
From: pinskia at gcc dot gnu.org @ 2014-07-19  6:20 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #6 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Created attachment 33156
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=33156&action=edit
Patch which I am testing

Patch to the C front-end which merges the section name both directions and not
just from the old decl to the new one (functions decls discard the new one
anyways).


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

* [Bug middle-end/61848] [4.10 Regression] a previous declaration causes the section attribute to be lost
  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
                   ` (5 preceding siblings ...)
  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
                   ` (15 subsequent siblings)
  22 siblings, 0 replies; 24+ messages in thread
From: pinskia at gcc dot gnu.org @ 2014-08-12 16:20 UTC (permalink / raw)
  To: gcc-bugs

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

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |jgreenhalgh at gcc dot gnu.org

--- Comment #7 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
*** Bug 62108 has been marked as a duplicate of this bug. ***


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

* [Bug middle-end/61848] [5 Regression] a previous declaration causes the section attribute to be lost
  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
                   ` (6 preceding siblings ...)
  2014-08-12 16:20 ` pinskia at gcc dot gnu.org
@ 2014-09-03  6:39 ` ryabinin.a.a at gmail dot com
  2014-09-11  1:14 ` pinskia at gcc dot gnu.org
                   ` (14 subsequent siblings)
  22 siblings, 0 replies; 24+ messages in thread
From: ryabinin.a.a at gmail dot com @ 2014-09-03  6:39 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #8 from Andrey Ryabinin <ryabinin.a.a at gmail dot com> ---
Hi, may I ask what's the status of this?

Besides of section mismatches in linux kernel it also breaks kernel's modules.
Variable __this_module doesn't get into section ".gnu.linkonce.this_module",
therefore module refuses to load.


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

* [Bug middle-end/61848] [5 Regression] a previous declaration causes the section attribute to be lost
  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
                   ` (7 preceding siblings ...)
  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
                   ` (13 subsequent siblings)
  22 siblings, 0 replies; 24+ messages in thread
From: pinskia at gcc dot gnu.org @ 2014-09-11  1:14 UTC (permalink / raw)
  To: gcc-bugs

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

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |jan.smets@alcatel-lucent.co
                   |                            |m

--- Comment #9 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
*** Bug 63221 has been marked as a duplicate of this bug. ***


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

* [Bug middle-end/61848] [5 Regression] a previous declaration causes the section attribute to be lost
  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
                   ` (8 preceding siblings ...)
  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
                   ` (12 subsequent siblings)
  22 siblings, 0 replies; 24+ messages in thread
From: amodra at gmail dot com @ 2014-09-12 14:57 UTC (permalink / raw)
  To: gcc-bugs

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

Alan Modra <amodra at gmail dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |amodra at gmail dot com

--- Comment #10 from Alan Modra <amodra at gmail dot com> ---
Created attachment 33480
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=33480&action=edit
A different approach to fixing this bug

I was playing with this one today, before I found your bugzilla Andrew.  It has
been regression tested on x86_64, fixes the loss of section attributes, and
builds a 3.16 x86_64 defconfig kernel - haven't checked if it boots yet..

Adds a fix for C++ which has the same problem as C.  (The s/olddecl/newdecl/
lines are because "if (TREE_CODE (newdecl) == FUNCTION_DECL) ... else switch
(TREE_CODE (olddecl))" looks horrible.  Cosmetic really since we exit the
function before this code if TREE_CODE (newdecl) != TREE_CODE (olddecl).)


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

* [Bug middle-end/61848] [5 Regression] a previous declaration causes the section attribute to be lost
  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
                   ` (9 preceding siblings ...)
  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
                   ` (11 subsequent siblings)
  22 siblings, 0 replies; 24+ messages in thread
From: amodra at gmail dot com @ 2014-09-12 23:26 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #11 from Alan Modra <amodra at gmail dot com> ---
It boots
Linux version 3.17.0-rc4-00222-gc73f6fd-dirty (anton@tul181p1) (gcc version
5.0.0 20140912 (experimental) (GCC) ) #23 SMP Fri Sep 12 21:19:06 UTC 2014


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

* [Bug middle-end/61848] [5 Regression] a previous declaration causes the section attribute to be lost
  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
                   ` (10 preceding siblings ...)
  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
                   ` (10 subsequent siblings)
  22 siblings, 0 replies; 24+ messages in thread
From: amodra at gmail dot com @ 2014-09-12 23:44 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #12 from Alan Modra <amodra at gmail dot com> ---
extern char foo;
char foo __attribute__ ((__section__(".machine.desc")));
char foo __attribute__ ((__section__(".mymachine.desc")));

It looks like we should take out the DECL_SECTION_NAME (olddecl) == NULL
checks.
The above gives no diagnostic with older compilers, and results in section
.mymachine.desc being used.  trunk+patch results in section .machine.desc.


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

* [Bug middle-end/61848] [5 Regression] a previous declaration causes the section attribute to be lost
  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
                   ` (11 preceding siblings ...)
  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
                   ` (9 subsequent siblings)
  22 siblings, 0 replies; 24+ messages in thread
From: sasha.levin at oracle dot com @ 2014-09-18 16:49 UTC (permalink / raw)
  To: gcc-bugs

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

Sasha Levin <sasha.levin at oracle dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |sasha.levin at oracle dot com

--- Comment #13 from Sasha Levin <sasha.levin at oracle dot com> ---
*** Bug 63279 has been marked as a duplicate of this bug. ***


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

* [Bug middle-end/61848] [5 Regression] a previous declaration causes the section attribute to be lost
  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
                   ` (12 preceding siblings ...)
  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
                   ` (8 subsequent siblings)
  22 siblings, 0 replies; 24+ messages in thread
From: pinskia at gcc dot gnu.org @ 2014-09-23 15:18 UTC (permalink / raw)
  To: gcc-bugs

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

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |mliska at suse dot cz

--- Comment #14 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
*** Bug 63344 has been marked as a duplicate of this bug. ***


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

* [Bug middle-end/61848] [5 Regression] a previous declaration causes the section attribute to be lost
  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
                   ` (13 preceding siblings ...)
  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
                   ` (7 subsequent siblings)
  22 siblings, 0 replies; 24+ messages in thread
From: andi-gcc at firstfloor dot org @ 2014-09-26 14:58 UTC (permalink / raw)
  To: gcc-bugs

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

Andi Kleen <andi-gcc at firstfloor dot org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |andi-gcc at firstfloor dot org

--- Comment #15 from Andi Kleen <andi-gcc at firstfloor dot org> ---
*** Bug 63382 has been marked as a duplicate of this bug. ***


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

* [Bug middle-end/61848] [5 Regression] a previous declaration causes the section attribute to be lost
  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
                   ` (14 preceding siblings ...)
  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
                   ` (6 subsequent siblings)
  22 siblings, 0 replies; 24+ messages in thread
From: andi-gcc at firstfloor dot org @ 2014-09-28 18:00 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #16 from Andi Kleen <andi-gcc at firstfloor dot org> ---
Can Alan's patch be submitted please?

I always need to apply it now before compiling a kernel.


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

* [Bug middle-end/61848] [5 Regression] a previous declaration causes the section attribute to be lost
  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
                   ` (15 preceding siblings ...)
  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
                   ` (5 subsequent siblings)
  22 siblings, 0 replies; 24+ messages in thread
From: pinskia at gcc dot gnu.org @ 2014-09-28 18:12 UTC (permalink / raw)
  To: gcc-bugs

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

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |patch
                URL|                            |https://gcc.gnu.org/ml/gcc-
                   |                            |patches/2014-09/msg01146.ht
                   |                            |ml
           Assignee|pinskia at gcc dot gnu.org         |amodra at gcc dot gnu.org

--- Comment #17 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
(In reply to Andi Kleen from comment #16)
> Can Alan's patch be submitted please?

It was https://gcc.gnu.org/ml/gcc-patches/2014-09/msg01146.html .


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

* [Bug middle-end/61848] [5 Regression] a previous declaration causes the section attribute to be lost
  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
                   ` (16 preceding siblings ...)
  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
                   ` (4 subsequent siblings)
  22 siblings, 0 replies; 24+ messages in thread
From: trippels at gcc dot gnu.org @ 2014-09-28 18:14 UTC (permalink / raw)
  To: gcc-bugs

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

Markus Trippelsdorf <trippels at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|patch                       |
                URL|https://gcc.gnu.org/ml/gcc- |
                   |patches/2014-09/msg01146.ht |
                   |ml                          |
           Assignee|amodra at gcc dot gnu.org          |pinskia at gcc dot gnu.org

--- Comment #18 from Markus Trippelsdorf <trippels at gcc dot gnu.org> ---
(In reply to Andi Kleen from comment #16)
> Can Alan's patch be submitted please?
> 
> I always need to apply it now before compiling a kernel.

See deadlocked discussion:
http://thread.gmane.org/gmane.comp.gcc.patches/321758/

Here's a testcase suitable for both C++ and C:

/* { dg-do compile } */
/* { dg-require-effective-target named_sections } */
/* { dg-final { scan-assembler "mysection" } } */
extern char foo;
char foo __attribute__ ((__section__(".mysection")));


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

* [Bug middle-end/61848] [5 Regression] a previous declaration causes the section attribute to be lost
  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
                   ` (17 preceding siblings ...)
  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
                   ` (3 subsequent siblings)
  22 siblings, 0 replies; 24+ messages in thread
From: trippels at gcc dot gnu.org @ 2014-09-28 18:18 UTC (permalink / raw)
  To: gcc-bugs

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

Markus Trippelsdorf <trippels at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |patch
                URL|                            |https://gcc.gnu.org/ml/gcc-
                   |                            |patches/2014-09/msg01146.ht
                   |                            |ml
           Assignee|pinskia at gcc dot gnu.org         |amodra at gcc dot gnu.org

--- Comment #19 from Markus Trippelsdorf <trippels at gcc dot gnu.org> ---
didn't mean to change the headers.


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

* [Bug middle-end/61848] [5 Regression] a previous declaration causes the section attribute to be lost
  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
                   ` (18 preceding siblings ...)
  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
                   ` (2 subsequent siblings)
  22 siblings, 0 replies; 24+ messages in thread
From: andi-gcc at firstfloor dot org @ 2014-09-28 18:30 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #20 from Andi Kleen <andi-gcc at firstfloor dot org> ---
So the only problem was the missing test case, which you supplied?


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

* [Bug middle-end/61848] [5 Regression] a previous declaration causes the section attribute to be lost
  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
                   ` (19 preceding siblings ...)
  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
  22 siblings, 0 replies; 24+ messages in thread
From: amodra at gmail dot com @ 2014-10-16  4:52 UTC (permalink / raw)
  To: gcc-bugs

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

Alan Modra <amodra at gmail dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|ASSIGNED                    |NEW
           Assignee|amodra at gcc dot gnu.org          |unassigned at gcc dot gnu.org


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

* [Bug middle-end/61848] [5 Regression] a previous declaration causes the section attribute to be lost
  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
                   ` (20 preceding siblings ...)
  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
  22 siblings, 0 replies; 24+ messages in thread
From: trippels at gcc dot gnu.org @ 2014-10-17  5:10 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #21 from Markus Trippelsdorf <trippels at gcc dot gnu.org> ---
Author: trippels
Date: Fri Oct 17 05:10:07 2014
New Revision: 216361

URL: https://gcc.gnu.org/viewcvs?rev=216361&root=gcc&view=rev
Log:
Fix pr61848, linux kernel miscompile

This patch cures the linux kernel boot failure when compiled using
trunk gcc.

At its heart, the problem is caused by merge_decls merging from the
old decl to the new decl, then copying back to the old decl and
discarding the new.  When Jan moved some fields to the symtab,
"copying back to the old decl" was lost for those fields.  Really,
it would be best if merge_decls was rewritten to merge everything to
the kept decl, but here I'm just doing that for fields accessed via
decl_with_vis.symtab_node.

2014-10-17  Alan Modra  <amodra@gmail.com>

gcc/c/
    PR middle-end/61848
    * c-decl.c (merge_decls): Don't merge section name or tls model
    to newdecl symtab node, instead merge to olddecl.  Override
    existing olddecl section name.  Set tls_model for all thread-local
    vars, not just OMP thread-private ones.  Remove incorrect comment.
gcc/cp/
    PR middle-end/61848
    * decl.c (merge_decls): Don't merge section name, comdat group or
    tls model to newdecl symtab node, instead merge to olddecl.
    Override existing olddecl section name.  Set tls_model for all
    thread-local vars, not just OMP thread-private ones.  Remove
    incorrect comment.

2014-10-17  Markus Trippelsdorf  <markus@trippelsdorf.de>

    PR middle-end/61848
    * g++.dg/torture/pr61848.C: New testcase.
    * gcc.c-torture/compile/pr61848.c: New testcase.

Added:
    trunk/gcc/testsuite/g++.dg/torture/pr61848.C
    trunk/gcc/testsuite/gcc.c-torture/compile/pr61848.c
Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/c/c-decl.c
    trunk/gcc/cp/ChangeLog
    trunk/gcc/cp/decl.c
    trunk/gcc/testsuite/ChangeLog


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

* [Bug middle-end/61848] [5 Regression] a previous declaration causes the section attribute to be lost
  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
                   ` (21 preceding siblings ...)
  2014-10-17  5:10 ` trippels at gcc dot gnu.org
@ 2014-10-17  5:23 ` trippels at gcc dot gnu.org
  22 siblings, 0 replies; 24+ messages in thread
From: trippels at gcc dot gnu.org @ 2014-10-17  5:23 UTC (permalink / raw)
  To: gcc-bugs

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

Markus Trippelsdorf <trippels at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|---                         |FIXED
           Assignee|unassigned at gcc dot gnu.org      |trippels at gcc dot gnu.org

--- Comment #22 from Markus Trippelsdorf <trippels at gcc dot gnu.org> ---
Finally fixed. Thanks.


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