[Bug sanitizer/97067] New: UBSAN: False positive maybe-uninitialized
vincent.lebourlot at starqube dot com
gcc-bugzilla@gcc.gnu.org
Wed Sep 16 09:28:20 GMT 2020
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97067
Bug ID: 97067
Summary: UBSAN: False positive maybe-uninitialized
Product: gcc
Version: 11.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: sanitizer
Assignee: unassigned at gcc dot gnu.org
Reporter: vincent.lebourlot at starqube dot com
CC: dodji at gcc dot gnu.org, dvyukov at gcc dot gnu.org,
jakub at gcc dot gnu.org, kcc at gcc dot gnu.org, marxin at gcc dot gnu.org
Target Milestone: ---
Compiling with -Wall -fsanitize=undefined the following code causes a false
positive:
```
void nothing(){return;}
int toto=[](){nothing();return 0;}();
int main(){return 0;}
````
warnings are:
main.cpp: In function ‘void __static_initialization_and_destruction_0(int,
int)’:
main.cpp:3:35: warning: ‘<unknown>’ may be used uninitialized
[-Wmaybe-uninitialized]
3 | int toto=[](){nothing();return 0;}();
| ~~~~~~~~~~~~~~~~~~~~~~~~~^~
main.cpp:3:10: note: by argument 1 of type ‘const<lambda()>*’ to ‘<lambda()>’
declared here
3 | int toto=[](){nothing();return 0;}();
| ^
main.cpp:3:10: note: ‘<anonymous>’ declared here
3 | int toto=[](){nothing();return 0;}();
| ^~~~~~~~~~~~~~~~~~~~~~~~~
More information about the Gcc-bugs
mailing list