* bug#47518: 28.0.50; gcc 5.5.0 -Wstrict-overflow warning in INT_ADD_WRAPV
@ 2021-03-31 10:12 David Fussner via Bug reports for GNU Emacs, the Swiss army knife of text editors
2021-05-08 12:08 ` Lars Ingebrigtsen
0 siblings, 1 reply; 3+ messages in thread
From: David Fussner via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2021-03-31 10:12 UTC (permalink / raw)
To: 47518
Since late December, when compiling master with gcc 5.5.0 on a 32-bit
Slackware install I see multiple warnings like the following. _All_
of the messages involve INT_ADD_WRAPV:
In file included from dispnew.c:27:0:
lisp.h: In function 'modiff_incr':
lisp.h:3505:3: warning: assuming signed overflow does not occur when
assuming that (X + c) > X is always true [-Wstrict-overflow]
bool modiff_overflow = INT_ADD_WRAPV (a0, 1, a);
^
(This last from every .c file that includes lisp.h.)
Slightly more informatively:
In file included from lisp.h:34:0,
from casefiddle.c:25:
casefiddle.c: In function 'do_casify_multibyte_string':
casefiddle.c:276:43: warning: assuming signed overflow does not occur
when assuming that (X + c) > X is always true [-Wstrict-overflow]
|| INT_ADD_WRAPV (n, sizeof (struct casing_str_buf), &n))
^
../lib/intprops.h:556:30: note: in definition of macro
'_GL_INT_ADD_RANGE_OVERFLOW'
&& (a) < (tmin) - (b)) \
^
../lib/intprops.h:505:11: note: in expansion of macro '_GL_INT_OP_CALC'
? _GL_INT_OP_CALC (a, b, r, op, overflow, unsigned long long int, \
^
../lib/intprops.h:495:7: note: in expansion of macro '_GL_INT_OP_WRAPV_LONGISH'
: _GL_INT_OP_WRAPV_LONGISH(a, b, r, op, overflow))
^
../lib/intprops.h:387:4: note: in expansion of macro '_GL_INT_OP_WRAPV'
_GL_INT_OP_WRAPV (a, b, r, +, _GL_INT_ADD_RANGE_OVERFLOW)
^
casefiddle.c:276:10: note: in expansion of macro 'INT_ADD_WRAPV'
|| INT_ADD_WRAPV (n, sizeof (struct casing_str_buf), &n))
^
In the gnulib updates from 24/12/2020, commit 29064d02c31, there's this
change to lib/intprops.h:231
/* True if __builtin_add_overflow (A, B, P) and __builtin_sub_overflow
(A, B, P) work when P is non-null. */
-#if 5 <= __GNUC__ && !defined __ICC
+/* __builtin_{add,sub}_overflow exists but is not reliable in GCC 5.x and 6.x,
+ see <https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98269>. */
+#if 7 <= __GNUC__ && !defined __ICC
# define _GL_HAS_BUILTIN_ADD_OVERFLOW 1
#elif defined __has_builtin
# define _GL_HAS_BUILTIN_ADD_OVERFLOW __has_builtin (__builtin_add_overflow)
Reverting this hunk makes the messages go away. From this I conclude
that the non-builtin version of INT_ADD_WRAPV triggers the warnings,
but staring at the code left me no wiser. I assume that someone using
a more up-to-date compiler could simply change the 7 in that hunk to
15 in order to force use of the non-builtin version to reproduce this,
but I haven't a system upon which to try it, and since
-Wstrict-overflow behavior may have changed since version 5 I'm not
sure this will work anyway. I turned off the warnings in
m4/manywarnings.m4 in my local copy and promptly forgot about it
(hence the delay before reporting it), so if this really is spurious
then a patch like:
diff --git a/m4/manywarnings.m4 b/m4/manywarnings.m4
index c3ac28752b..7f8f6f8080 100644
--- a/m4/manywarnings.m4
+++ b/m4/manywarnings.m4
@@ -184,6 +184,11 @@ AC_DEFUN
gl_AS_VAR_APPEND([$1], [' -funit-at-a-time'])
;;
esac
+ case `($CC --version) 2>/dev/null` in
+ 'gcc (GCC) '[[5-6]].*.*)
+ gl_AS_VAR_APPEND([$1], [' -Wno-strict-overflow'])
+ ;;
+ esac
fi
# Disable specific options as needed.
works for me (perhaps with more gcc versions included?).
I have a complete log of the error messages from the build if that
would be useful.
Many thanks,
David.
In GNU Emacs 28.0.50 (build 13, i686-pc-linux-gnu, GTK+ Version
3.18.9, cairo version 1.14.6)
of 2021-03-30 built on newfont
Repository revision: 4bfcfdb41638f37c89c0db8f297707773c677656
Repository branch: master
Windowing system distributor 'The X.Org Foundation', version 11.0.11803000
System Description: Slackware 14.2
Configured using:
'configure
PKG_CONFIG_PATH=/usr/local/lib/pkgconfig:/usr/local/share/pkgconfig:/usr/lib/pkgconfig:/usr/share/pkgconfig'
Configured features:
ACL CAIRO DBUS FREETYPE GIF GLIB GMP GNUTLS GPM GSETTINGS HARFBUZZ JPEG
LCMS2 LIBXML2 MODULES NOTIFY INOTIFY PDUMPER PNG RSVG SOUND THREADS TIFF
TOOLKIT_SCROLL_BARS X11 XDBE XIM XPM GTK3 ZLIB
Important settings:
value of $LC_COLLATE: C
value of $LANG: en_US.ISO8859-1
locale-coding-system: iso-latin-1-unix
^ permalink raw reply related [flat|nested] 3+ messages in thread
* bug#47518: 28.0.50; gcc 5.5.0 -Wstrict-overflow warning in INT_ADD_WRAPV
2021-03-31 10:12 bug#47518: 28.0.50; gcc 5.5.0 -Wstrict-overflow warning in INT_ADD_WRAPV David Fussner via Bug reports for GNU Emacs, the Swiss army knife of text editors
@ 2021-05-08 12:08 ` Lars Ingebrigtsen
2021-05-08 12:09 ` Lars Ingebrigtsen
0 siblings, 1 reply; 3+ messages in thread
From: Lars Ingebrigtsen @ 2021-05-08 12:08 UTC (permalink / raw)
To: David Fussner; +Cc: 47518
David Fussner <dfussner@googlemail.com> writes:
> Since late December, when compiling master with gcc 5.5.0 on a 32-bit
> Slackware install I see multiple warnings like the following. _All_
> of the messages involve INT_ADD_WRAPV:
>
> In file included from dispnew.c:27:0:
> lisp.h: In function 'modiff_incr':
> lisp.h:3505:3: warning: assuming signed overflow does not occur when
> assuming that (X + c) > X is always true [-Wstrict-overflow]
> bool modiff_overflow = INT_ADD_WRAPV (a0, 1, a);
> ^
> (This last from every .c file that includes lisp.h.)
It's to be expected to get warnings in older gcc versions for a variety
of things -- and gcc 5.5.0 is five years old. We don't have a strict
policy for this in Emacs, but it's been common to disregard warnings
from gcc versions that are a few years old.
So I'm closing this bug report. If somebody thinks that this is
something that should be worked on, please respond to the debbugs
address and we'll reopen.
--
(domestic pets only, the antidote for overdose, milk.)
bloggy blog: http://lars.ingebrigtsen.no
^ permalink raw reply [flat|nested] 3+ messages in thread
* bug#47518: 28.0.50; gcc 5.5.0 -Wstrict-overflow warning in INT_ADD_WRAPV
2021-05-08 12:08 ` Lars Ingebrigtsen
@ 2021-05-08 12:09 ` Lars Ingebrigtsen
0 siblings, 0 replies; 3+ messages in thread
From: Lars Ingebrigtsen @ 2021-05-08 12:09 UTC (permalink / raw)
To: David Fussner; +Cc: 47518
Lars Ingebrigtsen <larsi@gnus.org> writes:
> gcc 5.5.0 is five years old.
(Four years old -- off-by-one error.)
--
(domestic pets only, the antidote for overdose, milk.)
bloggy blog: http://lars.ingebrigtsen.no
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2021-05-08 12:09 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-03-31 10:12 bug#47518: 28.0.50; gcc 5.5.0 -Wstrict-overflow warning in INT_ADD_WRAPV David Fussner via Bug reports for GNU Emacs, the Swiss army knife of text editors
2021-05-08 12:08 ` Lars Ingebrigtsen
2021-05-08 12:09 ` Lars Ingebrigtsen
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).