Skip to content

Instantly share code, notes, and snippets.

@fujii
Created October 15, 2018 04:54
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save fujii/afb137300be40c71ea61b28391035ce7 to your computer and use it in GitHub Desktop.
Save fujii/afb137300be40c71ea61b28391035ce7 to your computer and use it in GitHub Desktop.
fujii@ubuntu3 $ cat a.cc
int main()
{
int x;
return x;
}
fujii@ubuntu3 $ clang++ --version
,clang version 7.0.0 (tags/RELEASE_700/final)
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir: /home/fujii/work/llvm/clang+llvm-7.0.0-x86_64-linux-gnu-ubuntu-16.04/bin
fujii@ubuntu3 $ clang++ -Wall -c a.cc
a.cc:5:10: warning: variable 'x' is uninitialized when used here [-Wuninitialized]
return x;
^
a.cc:4:8: note: initialize the variable 'x' to silence this warning
int x;
^
= 0
1 warning generated.
fujii@ubuntu3 $ clang++ -Wall -Wno-uninitialized -c a.cc
fujii@ubuntu3 $ clang++ -Wno-uninitialized -Wall -c a.cc
a.cc:5:10: warning: variable 'x' is uninitialized when used here [-Wuninitialized]
return x;
^
a.cc:4:8: note: initialize the variable 'x' to silence this warning
int x;
^
= 0
1 warning generated.
fujii@ubuntu3 $ clang++ -Wno-uninitialized -Wuninitialized -c a.cc
a.cc:5:10: warning: variable 'x' is uninitialized when used here [-Wuninitialized]
return x;
^
a.cc:4:8: note: initialize the variable 'x' to silence this warning
int x;
^
= 0
1 warning generated.
fujii@ubuntu3 $ clang++ -Wuninitialized -Wno-uninitialized -c a.cc
fujii@ubuntu3 $ g++ --version
g++ (Ubuntu 7.3.0-27ubuntu1~18.04) 7.3.0
Copyright (C) 2017 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.
fujii@ubuntu3 $ g++ -Wall -c a.cc
a.cc: In function ‘int main()’:
a.cc:5:10: warning: ‘x’ is used uninitialized in this function [-Wuninitialized]
return x;
^
fujii@ubuntu3 $ g++ -Wall -Wno-uninitialized -c a.cc
fujii@ubuntu3 $ g++ -Wno-uninitialized -Wall -c a.cc
fujii@ubuntu3 $ g++ -Wno-uninitialized -Wuninitialized -c a.cc
a.cc: In function ‘int main()’:
a.cc:5:10: warning: ‘x’ is used uninitialized in this function [-Wuninitialized]
return x;
^
fujii@ubuntu3 $ g++ -Wuninitialized -Wno-uninitialized -c a.cc
fujii@ubuntu3 $
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment