[Bug c++/18635] [DR 504] use of uninitialised reference accepted (without -Wuninitialized) in C++ front end
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=18635 --- Comment #21 from Jonathan Wakely --- Yes, the core issue is still active, so currently compilers are required to accept the code rather than reject it as ill-formed. If that changes, we can un-suspend this.
[Bug c++/18635] [DR 504] use of uninitialised reference accepted (without -Wuninitialized) in C++ front end
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=18635 Martin Sebor changed: What|Removed |Added Blocks|24639 | --- Comment #20 from Martin Sebor --- So the open question is whether to issue an error in the front end rather than a warning in the middle end. Let me remove the dependency on -Wuninitialized then since there's nothing to do there. Referenced Bugs: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=24639 [Bug 24639] [meta-bug] bug to track all Wuninitialized issues
[Bug c++/18635] [DR 504] use of uninitialised reference accepted (without -Wuninitialized) in C++ front end
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=18635 Manuel López-Ibáñez changed: What|Removed |Added URL||http://www.open-std.org/jtc ||1/sc22/wg21/docs/papers/201 ||1/n3293.html#504 --- Comment #19 from Manuel López-Ibáñez --- (In reply to Martin Sebor from comment #18) > What is this a request for? What GCC should do depends on the DR which is still open. Until the DR is resolved one way or another, this PR should stay suspended.
[Bug c++/18635] [DR 504] use of uninitialised reference accepted (without -Wuninitialized) in C++ front end
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=18635 Martin Sebor changed: What|Removed |Added CC||msebor at gcc dot gnu.org --- Comment #18 from Martin Sebor --- What is this a request for? GCC 11 issues the warnings below, as well as for most of the test cases here. Since (I assume most of us agree) rejecting the code would not be correct/conforming, is there something else to enhance? (There are bugs/limitations in -Wuninitialized that prevent diagnosing some similar cases but I'd expect to track those as bugs separately from this request.) $ cat t.C && gcc -S -Wall t.C const int* fcp (const int *); void gcp () { const int *p = fcp (p);// -Wuninitialized } const int& fcr (const int &); void gcr () { const int = fcr (i);// -Wuninitialized } int& fr (int &); void gr () { int = fr (r); // -Wuninitialized } t.C: In function ‘void gcp()’: t.C:5:22: warning: ‘p’ is used uninitialized [-Wuninitialized] 5 | const int *p = fcp (p);// -Wuninitialized | ^~~ t.C:5:14: note: ‘p’ was declared here 5 | const int *p = fcp (p);// -Wuninitialized | ^ t.C: In function ‘void gcr()’: t.C:12:22: warning: ‘i’ is used uninitialized [-Wuninitialized] 12 | const int = fcr (i);// -Wuninitialized | ^~~ t.C:12:14: note: ‘i’ was declared here 12 | const int = fcr (i);// -Wuninitialized | ^ t.C: In function ‘void gr()’: t.C:19:15: warning: ‘r’ is used uninitialized [-Wuninitialized] 19 | int = fr (r); // -Wuninitialized |~~~^~~ t.C:19:8: note: ‘r’ was declared here 19 | int = fr (r); // -Wuninitialized |^
[Bug c++/18635] [DR 504] use of uninitialised reference accepted (without -Wuninitialized) in C++ front end
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=18635 Eric Gallager changed: What|Removed |Added Keywords|accepts-invalid |diagnostic Blocks||24639 Summary|[DR 504] use of |[DR 504] use of |uninitialised reference |uninitialised reference |accepted in C++ front end |accepted (without ||-Wuninitialized) in C++ ||front end Severity|normal |enhancement --- Comment #17 from Eric Gallager --- (In reply to Jonathan Wakely from comment #16) > This is > http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2011/n3293.html#504 which > is Open, so I'm suspending this. If/when that gets resolved we can revisit > this PR. > > I think SUSPENDED rather than INVALID is being generous, as G++ is > completely correct to accept the code, and follows the committee's > intentions: > "Implementations can warn about such constructs, and the resolution for > issue 453 makes executing such code undefined behavior; that seemed to > address the situation adequately." Changing from an accepts-invalid to an enhancement request for an optional -Wuninitialized diagnostic then Referenced Bugs: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=24639 [Bug 24639] [meta-bug] bug to track all Wuninitialized issues