[Bug c++/80635] std::optional and bogus -Wmaybe-uninitialized warning
manu at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Tue Dec 17 21:44:00 GMT 2019
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80635
--- Comment #35 from Manuel López-Ibáñez <manu at gcc dot gnu.org> ---
In any case, looking at the uninit dump with -fdump-tree-all-all-lineno it
appears that GCC knows the block where the warning is triggered is never
executed:
;; basic block 13, loop depth 0, count 0 (precise), probably never executed
;; prev block 12, next block 14, flags: (NEW, REACHABLE, VISITED)
;; pred: 12 [never] count:0 (precise) (EH,EXECUTABLE)
;; starting at line -1
<L6>: [LP 2]
# DEBUG c1$16$iD.2602 => c1$16$i_9
# DEBUG c1D.2601 => 1
# DEBUG thisD.2599 => &c1D.2412
[./example.cpp:20:23] # DEBUG D#2ptD.0 => [./example.cpp:20:23]
&[./example.cpp:20:18] [./example.cpp:20:18] c1D.2412.D.2424.tD.2426
[./example.cpp:20:23] # DEBUG thisD.2600 => D#2ptD.0
[./example.cpp:9:11] # DEBUG BEGIN_STMT
[./example.cpp:9:13] # .MEM_27 = VDEF <.MEM_15>
xD.2332 = c1$16$i_9;
[./example.cpp:9:18] goto <bb 15>; [0.00%]
;; succ: 15 [never] count:0 (precise) (FALLTHRU,EXECUTABLE)
I remember seeing other bugs where the block info could be used to avoid
warning.
More information about the Gcc-bugs
mailing list