diff options
author | Jeffrey Walton <noloader@gmail.com> | 2022-08-24 23:00:04 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-08-24 23:00:04 -0400 |
commit | 0b5747421b279283fc6d1b1065dc01fb5d1ec997 (patch) | |
tree | 3bc490e2e4f80f3c2ff907f35d48112da44a46b7 /TestPrograms | |
parent | 307ada58d618eb05c89b6e4a6bc55ac4026a7e9a (diff) | |
download | cryptopp-git-0b5747421b279283fc6d1b1065dc01fb5d1ec997.tar.gz |
Add -fno-devirtualize when using GCC 12 (GH #1134, GH #1141, PR #1147)
This is not a fix since it only treats the symptom of GCC removing live code. We do not know why GCC is doing it.
Diffstat (limited to 'TestPrograms')
-rw-r--r-- | TestPrograms/test_nodevirtualize.cpp | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/TestPrograms/test_nodevirtualize.cpp b/TestPrograms/test_nodevirtualize.cpp new file mode 100644 index 00000000..ad4489a4 --- /dev/null +++ b/TestPrograms/test_nodevirtualize.cpp @@ -0,0 +1,19 @@ +#include <string>
+
+// https://gcc.gnu.org/onlinedocs/cpp/Common-Predefined-Macros.html
+#define GCC_VERSION (__GNUC__ * 10000 + __GNUC_MINOR__ * 100 + __GNUC_PATCHLEVEL__)
+
+int main(int argc, char* argv[])
+{
+ // GCC 12 is removing live code. We don't know why.
+ // https://github.com/weidai11/cryptopp/issues/1134 and
+ // https://github.com/weidai11/cryptopp/issues/1141
+#if defined(__linux__) && (GCC_VERSION >= 120000)
+ // On successful compile -fno-devirtualize will be used
+ // to work around the problem.
+ ;;
+#else
+ int x[-1];
+#endif
+ return 0;
+}
|