The particular trigger for disabling this now was
changing copy_debug_string() from using unreachable()
to assert() will incorrectly induce gcc 16.1 to suggest
adding __attribute(pure) even though this static function
may have side effects like aborting the program.
Note given the current use of copy_debug_string(),
that would likely be OK to allow common subexpression elimination,
however "pure" also allows for calls to be removed entirely
depending on usage of the function (as noted in the bug url below).
Therefore it's safer to avoid all this until at least
the compiler bug below is addressed.
* configure.ac: Remove -Wsuggest-attribute={pure,const}.
These are currently innacurate and dangerous.
See https://gcc.gnu.org/PR115237
---
configure.ac | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/configure.ac b/configure.ac
index 25fabe49d..3b44c5778 100644
--- a/configure.ac
+++ b/configure.ac
@@ -231,6 +231,12 @@ if test $gl_gcc_warnings != no; then
nw="$nw -Wsuggest-attribute=noreturn"
fi
+ # Suppress warnings to add pure or const attributes,
+ # as these are currently inaccurate and dangerous.
+ # See https://gcc.gnu.org/PR115237
+ nw="$nw -Wsuggest-attribute=pure"
+ nw="$nw -Wsuggest-attribute=const"
+
# Using -Wstrict-overflow is a pain, but the alternative is worse.
# For an example, see the code that provoked this report:
# https://gcc.gnu.org/PR33498
--
2.55.0