Created
May 30, 2018 22:34
-
-
Save stefantalpalaru/3e984cf56c2eea462ae761143e0d0dfd to your computer and use it in GitHub Desktop.
GCC precompiled header bug on bdver2 with -march=native
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include "stdafx.h" | |
int main(int argc, char**argv) | |
{ | |
std::string s = "Hi"; | |
std::cout << s << std::endl; | |
return 0; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
set -euo pipefail | |
CXXFLAGS="-O3 -march=native -pipe -Winvalid-pch" | |
# on an AMD FX-8320E this appears, about 40% of the time, with both gcc-7.3.0 and gcc-8.1.0, on Gentoo ~amd64: | |
#a.cpp:1:20: warning: stdafx.h.gch: created and used with differing settings of '-mlwp' | |
# #include "stdafx.h" | |
# ^ | |
#CXXFLAGS="-O3 -march=bdver2 -pipe -Winvalid-pch" | |
# no warning with an explicit -march | |
rm -f stdafx.h.gch a | |
g++ $CXXFLAGS -c stdafx.h -o stdafx.h.gch | |
g++ $CXXFLAGS -o a a.cpp |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <string> | |
#include <iostream> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment