This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug c++/71528] New: multiple extern reference declarations produce uninitialized access


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

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]