public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/99508] New: Asm labels declared inside a function are ignored
@ 2021-03-10  8:22 frank.mehnert at googlemail dot com
  2021-03-10  8:43 ` [Bug c++/99508] [11 Regression] " rguenth at gcc dot gnu.org
                   ` (5 more replies)
  0 siblings, 6 replies; 7+ messages in thread
From: frank.mehnert at googlemail dot com @ 2021-03-10  8:22 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 99508
           Summary: Asm labels declared inside a function are ignored
           Product: gcc
           Version: unknown
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: frank.mehnert at googlemail dot com
  Target Milestone: ---

This is apparently a gcc-11 regression. Following example:

#include <cstdio>
void foo()
{
  void bar() asm ("bar_assembler");
  extern unsigned buzz asm("buzz_assembler");
  bar();
  printf("%d\n", buzz);
}

Compile this C++ source code with -c and look at the generated symbols with
'objdump -tC'. 

g++-10:
0000000000000000         *UND*  0000000000000000 bar_assembler
0000000000000000         *UND*  0000000000000000 buzz_assembler
0000000000000000         *UND*  0000000000000000 printf

g++-11: (Debian experimental 20210306):
0000000000000000         *UND*  0000000000000000 bar()
0000000000000000         *UND*  0000000000000000 buzz
0000000000000000         *UND*  0000000000000000 printf

g++11 produces the same result as g++10 if 'bar' and 'buzz' are declared
outside foo().

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

* [Bug c++/99508] [11 Regression] Asm labels declared inside a function are ignored
  2021-03-10  8:22 [Bug c++/99508] New: Asm labels declared inside a function are ignored frank.mehnert at googlemail dot com
@ 2021-03-10  8:43 ` rguenth at gcc dot gnu.org
  2021-03-10  8:48 ` jakub at gcc dot gnu.org
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: rguenth at gcc dot gnu.org @ 2021-03-10  8:43 UTC (permalink / raw)
  To: gcc-bugs

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

Richard Biener <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Priority|P3                          |P1
      Known to work|                            |10.2.1
            Summary|Asm labels declared inside  |[11 Regression] Asm labels
                   |a function are ignored      |declared inside a function
                   |                            |are ignored
             Status|UNCONFIRMED                 |NEW
     Ever confirmed|0                           |1
   Target Milestone|---                         |11.0
           Keywords|                            |wrong-code
   Last reconfirmed|                            |2021-03-10
      Known to fail|                            |11.0

--- Comment #1 from Richard Biener <rguenth at gcc dot gnu.org> ---
Confirmed.  Works with the C frontend.

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

* [Bug c++/99508] [11 Regression] Asm labels declared inside a function are ignored
  2021-03-10  8:22 [Bug c++/99508] New: Asm labels declared inside a function are ignored frank.mehnert at googlemail dot com
  2021-03-10  8:43 ` [Bug c++/99508] [11 Regression] " rguenth at gcc dot gnu.org
@ 2021-03-10  8:48 ` jakub at gcc dot gnu.org
  2021-03-10 13:31 ` nathan at gcc dot gnu.org
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: jakub at gcc dot gnu.org @ 2021-03-10  8:48 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |jakub at gcc dot gnu.org,
                   |                            |nathan at gcc dot gnu.org

--- Comment #2 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
This changed with r11-3699-g4e62aca0e0520e4ed2532f2d8153581190621c1a

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

* [Bug c++/99508] [11 Regression] Asm labels declared inside a function are ignored
  2021-03-10  8:22 [Bug c++/99508] New: Asm labels declared inside a function are ignored frank.mehnert at googlemail dot com
  2021-03-10  8:43 ` [Bug c++/99508] [11 Regression] " rguenth at gcc dot gnu.org
  2021-03-10  8:48 ` jakub at gcc dot gnu.org
@ 2021-03-10 13:31 ` nathan at gcc dot gnu.org
  2021-03-10 15:51 ` cvs-commit at gcc dot gnu.org
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: nathan at gcc dot gnu.org @ 2021-03-10 13:31 UTC (permalink / raw)
  To: gcc-bugs

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

Nathan Sidwell <nathan at gcc dot gnu.org> changed:

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

--- Comment #3 from Nathan Sidwell <nathan at gcc dot gnu.org> ---
Apparently copy_decl doesn't copy_decl :)

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

* [Bug c++/99508] [11 Regression] Asm labels declared inside a function are ignored
  2021-03-10  8:22 [Bug c++/99508] New: Asm labels declared inside a function are ignored frank.mehnert at googlemail dot com
                   ` (2 preceding siblings ...)
  2021-03-10 13:31 ` nathan at gcc dot gnu.org
@ 2021-03-10 15:51 ` cvs-commit at gcc dot gnu.org
  2021-03-10 15:55 ` nathan at gcc dot gnu.org
  2021-03-20 10:30 ` frank.mehnert at googlemail dot com
  5 siblings, 0 replies; 7+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2021-03-10 15:51 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #4 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Nathan Sidwell <nathan@gcc.gnu.org>:

https://gcc.gnu.org/g:b97af562b574697a4fff7fb8c69f579c01e70dec

commit r11-7605-gb97af562b574697a4fff7fb8c69f579c01e70dec
Author: Nathan Sidwell <nathan@acm.org>
Date:   Wed Mar 10 07:39:51 2021 -0800

    c++: Propagate assembler name from local-externs [PR 99508]

    This is another place where our one-true-decl representation breaks
    down.  The fix here propagates the assembly name to the ns-scope
    alias.  that fixes the reported problem but changes the behaviour when
    the user has explicitly declared the entity in its namespace.
    However, we didn't handle that case 'correctly' anyway before.
    Previously we'd also ignore the explicitly specified assembler name,
    now we propagate it.  It's not clear to me what the desired semantics
    would be in decorating just one of the local extern declarations this
    way.  I don't think we can really do better without propagating this
    aliasing property into the middle end (which is also needed for some
    constexpr handling, see PR97306).  I tried that before and it turned
    into a rat-hole.

            PR c++/99508
            gcc/cp/
            * decl.c (make_rtl_for_nonlocal_decl): Propagate local-extern's
            assembler name to the ns alias.
            gcc/testsuite/
            * g++.dg/ext/pr99508.C: New.

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

* [Bug c++/99508] [11 Regression] Asm labels declared inside a function are ignored
  2021-03-10  8:22 [Bug c++/99508] New: Asm labels declared inside a function are ignored frank.mehnert at googlemail dot com
                   ` (3 preceding siblings ...)
  2021-03-10 15:51 ` cvs-commit at gcc dot gnu.org
@ 2021-03-10 15:55 ` nathan at gcc dot gnu.org
  2021-03-20 10:30 ` frank.mehnert at googlemail dot com
  5 siblings, 0 replies; 7+ messages in thread
From: nathan at gcc dot gnu.org @ 2021-03-10 15:55 UTC (permalink / raw)
  To: gcc-bugs

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

Nathan Sidwell <nathan at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|ASSIGNED                    |RESOLVED
         Resolution|---                         |FIXED

--- Comment #5 from Nathan Sidwell <nathan at gcc dot gnu.org> ---
b97af562b57 2021-03-10 | c++: Propagate assembler name from local-externs [PR
99508]

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

* [Bug c++/99508] [11 Regression] Asm labels declared inside a function are ignored
  2021-03-10  8:22 [Bug c++/99508] New: Asm labels declared inside a function are ignored frank.mehnert at googlemail dot com
                   ` (4 preceding siblings ...)
  2021-03-10 15:55 ` nathan at gcc dot gnu.org
@ 2021-03-20 10:30 ` frank.mehnert at googlemail dot com
  5 siblings, 0 replies; 7+ messages in thread
From: frank.mehnert at googlemail dot com @ 2021-03-20 10:30 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #6 from Frank Mehnert <frank.mehnert at googlemail dot com> ---
Fix confirmed. Thanks guys!

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

end of thread, other threads:[~2021-03-20 10:30 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-03-10  8:22 [Bug c++/99508] New: Asm labels declared inside a function are ignored frank.mehnert at googlemail dot com
2021-03-10  8:43 ` [Bug c++/99508] [11 Regression] " rguenth at gcc dot gnu.org
2021-03-10  8:48 ` jakub at gcc dot gnu.org
2021-03-10 13:31 ` nathan at gcc dot gnu.org
2021-03-10 15:51 ` cvs-commit at gcc dot gnu.org
2021-03-10 15:55 ` nathan at gcc dot gnu.org
2021-03-20 10:30 ` frank.mehnert at googlemail 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).