This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/71528] New: multiple extern reference declarations produce uninitialized access
- From: "P at draigBrady dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Tue, 14 Jun 2016 12:49:49 +0000
- Subject: [Bug c++/71528] New: multiple extern reference declarations produce uninitialized access
- Auto-submitted: auto-generated
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71528
Bug ID: 71528
Summary: multiple extern reference declarations produce
uninitialized access
Product: gcc
Version: unknown
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: P at draigBrady dot com
Target Milestone: ---
This is a regression since 5.1 which works with clang and gcc 4.x
The issue is due to the redundant extern reference declaration,
which results in use of an unitialized reference. I.E. in this snippet,
x will have the NULL pointer rather than that of the "new int":
extern int& x;
int& x = *(new int);
int main() { return !(&x); }
// Comment out the following line for expected operation
extern int& x;
https://godbolt.org/g/dDDPnw