[prev in list] [next in list] [prev in thread] [next in thread]
List: gcc-bugs
Subject: [Bug c/98902] New: -fmerge-all-constants leaves dangling reference
From: astrange at ithinksw dot com via Gcc-bugs <gcc-bugs () gcc ! gnu ! org>
Date: 2021-01-31 14:19:04
Message-ID: bug-98902-4 () http ! gcc ! gnu ! org/bugzilla/
[Download RAW message or body]
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.=
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic