id,summary,reporter,owner,description,type,status,milestone,component,version,severity,resolution,keywords,cc 12513,"Boost optional (1.60/1.61/1.62) generates ""may be used uninitialized"" warnings with gcc 6",romain.geissler@…,Fernando Cacciola,"Hi, I have met a small case where boost::optional wrongly generates gcc warnings about maybe uninitialized values. I could reduce my case and provide the attached reproducer. Note that this warning only happens when optimization are used (-O1 or -O2 while strangely no warning is emitted with -O3). It's built with (from a Fedora rawhide Docker container just cloned): [root@a064b4c04fc9 tmp]# g++ -std=gnu++14 -O2 -Wall -c -o test.o test.cpp test.cpp: In function 'void someFunction(const void*)': test.cpp:22:16: warning: '*((void*)& aOptional +4)' may be used uninitialized in this function [-Wmaybe-uninitialized] Optional_t aOptional; ^~~~~~~~~ [root@a064b4c04fc9 tmp]# g++ --version g++ (GCC) 6.2.1 20160916 (Red Hat 6.2.1-2) Copyright (C) 2016 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. Other bug reports in Boost are always mentioning https://gcc.gnu.org/bugzilla/show_bug.cgi?id=47679 as the root cause, but this is not true anymore since this gcc bug was closed last year and all commits made at the time have been released in gcc 6. Please note that I could reproduce as well with the latest trunk from gcc 7. This was reproduced with both Boost 1.60 and 1.61, but should happen as well in Boost 1.62 given that boost::optional did almost not change. Also note that using std::experiment::optional from gcc's libstdc++ implementation works just fine. I am not sure whether this is actually a Boost bug or a gcc one. If it's a gcc one then it's seems to be different from https://gcc.gnu.org/bugzilla/show_bug.cgi?id=47679. Can you please have a look. Thanks, Romain",Bugs,new,To Be Determined,optional,Boost 1.60.0,Problem,,optional gcc warning uninitialized,