The following was posted on comp.lanc.c++ by Ralf Goertz:
https://groups.google.com/d/msg/comp.lang.c++/Tb5Ir3A71nw/szKUC5j8AQAJ
#include <iostream>
int main(int argc, char *argv[])
{
int x;
if(argc > 1) x = 1;
std::cout << x << std::endl;
}
Despite the description of -Wmaybe-uninitialized, even with optimizing
compilation, neither gcc 8.2.1 nor gcc 7.3.1 report the expected warning
(with "c++ -Wall -O{1,3}").
Are we missing something?
Thanks in advance.
PS.
BTW the trivial C translation behaves the same with "cc -Wall -O{1,3}":
#include <stdio.h>
int main(int argc, char *argv[])
{
int x;
if(argc > 1) x = 1;
printf("%d\n", x);
}