public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/98902] New: -fmerge-all-constants leaves dangling reference
@ 2021-01-31 14:19 astrange at ithinksw dot com
  2021-01-31 14:57 ` [Bug c/98902] " schwab@linux-m68k.org
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: astrange at ithinksw dot com @ 2021-01-31 14:19 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 98902
           Summary: -fmerge-all-constants leaves dangling reference
           Product: gcc
           Version: 10.2.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
          Assignee: unassigned at gcc dot gnu.org
          Reporter: astrange at ithinksw dot com
  Target Milestone: ---

This source:
--
#include <stdio.h>

static const int a1[] = {1};
static const int a2[] = {1};

int main (void)
{
        printf("%p %p\n", a1, a2);
        return 0;
}
--

produces code where it doesn't emit 'a2' but still references it:
--
.LC0:
        .string "%p %p\n"
main:
        sub     rsp, 8
        mov     edx, OFFSET FLAT:a2
        mov     esi, OFFSET FLAT:a1
        xor     eax, eax
        mov     edi, OFFSET FLAT:.LC0
        call    printf
        xor     eax, eax
        add     rsp, 8
        ret
a1:
        .long   1
--

with '-O2 -fmerge-all-constants'. Did not verify this locally, just in compiler
explorer.

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

* [Bug c/98902] -fmerge-all-constants leaves dangling reference
  2021-01-31 14:19 [Bug c/98902] New: -fmerge-all-constants leaves dangling reference astrange at ithinksw dot com
@ 2021-01-31 14:57 ` schwab@linux-m68k.org
  2021-01-31 15:42 ` astrange at ithinksw dot com
  2021-01-31 15:44 ` schwab@linux-m68k.org
  2 siblings, 0 replies; 4+ messages in thread
From: schwab@linux-m68k.org @ 2021-01-31 14:57 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #1 from Andreas Schwab <schwab@linux-m68k.org> ---
What's your target?  There is supposed to be ".set a2,a1" at the end.

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

* [Bug c/98902] -fmerge-all-constants leaves dangling reference
  2021-01-31 14:19 [Bug c/98902] New: -fmerge-all-constants leaves dangling reference astrange at ithinksw dot com
  2021-01-31 14:57 ` [Bug c/98902] " schwab@linux-m68k.org
@ 2021-01-31 15:42 ` astrange at ithinksw dot com
  2021-01-31 15:44 ` schwab@linux-m68k.org
  2 siblings, 0 replies; 4+ messages in thread
From: astrange at ithinksw dot com @ 2021-01-31 15:42 UTC (permalink / raw)
  To: gcc-bugs

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

Alexander Strange <astrange at ithinksw dot com> changed:

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

--- Comment #2 from Alexander Strange <astrange at ithinksw dot com> ---
Interesting, this is a bug in the Compiler Explorer site. It's hiding .set
lines from me.

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

* [Bug c/98902] -fmerge-all-constants leaves dangling reference
  2021-01-31 14:19 [Bug c/98902] New: -fmerge-all-constants leaves dangling reference astrange at ithinksw dot com
  2021-01-31 14:57 ` [Bug c/98902] " schwab@linux-m68k.org
  2021-01-31 15:42 ` astrange at ithinksw dot com
@ 2021-01-31 15:44 ` schwab@linux-m68k.org
  2 siblings, 0 replies; 4+ messages in thread
From: schwab@linux-m68k.org @ 2021-01-31 15:44 UTC (permalink / raw)
  To: gcc-bugs

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

Andreas Schwab <schwab@linux-m68k.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         Resolution|FIXED                       |INVALID

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

end of thread, other threads:[~2021-01-31 15:44 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-01-31 14:19 [Bug c/98902] New: -fmerge-all-constants leaves dangling reference astrange at ithinksw dot com
2021-01-31 14:57 ` [Bug c/98902] " schwab@linux-m68k.org
2021-01-31 15:42 ` astrange at ithinksw dot com
2021-01-31 15:44 ` schwab@linux-m68k.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).