rpm/backport-Restore-some-compiler-sanity.patch
2022-11-03 16:53:48 +08:00

34 lines
1.0 KiB
Diff

From 5ee567ebd600c1dec4a9ceb6161d877d891d8594 Mon Sep 17 00:00:00 2001
From: Panu Matilainen <pmatilai@redhat.com>
Date: Thu, 18 Mar 2021 13:02:16 +0200
Subject: [PATCH] Restore (some) compiler sanity
-fno-strict-overflow tells gcc and clang to handle signed integer and
(at least on gcc) pointer arithmetic wraparound using twos-complement
representation like deity intended.
-fno-delete-null-pointer-checks tells gcc not to "optimize" away
programmer added safeguards. Really.
Suggested by Demi Marie Obenour.
---
configure.ac | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/configure.ac b/configure.ac
index fb9627d99..f2bbf2276 100644
--- a/configure.ac
+++ b/configure.ac
@@ -37,7 +37,7 @@ fi
AS=${AS-as}
AC_SUBST(AS)
if test "$GCC" = yes; then
- cflags_to_try="-fno-strict-aliasing -fstack-protector -Wempty-body"
+ cflags_to_try="-fno-strict-aliasing -fstack-protector -fno-strict-overflow -fno-delete-null-pointer-checks -Wempty-body"
AC_MSG_CHECKING([supported compiler flags])
old_cflags=$CFLAGS
echo
--
2.27.0