From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: David Fussner via "Bug reports for GNU Emacs, the Swiss army knife of text editors" Newsgroups: gmane.emacs.bugs Subject: bug#47518: 28.0.50; gcc 5.5.0 -Wstrict-overflow warning in INT_ADD_WRAPV Date: Wed, 31 Mar 2021 11:12:29 +0100 Message-ID: Reply-To: David Fussner Mime-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="852"; mail-complaints-to="usenet@ciao.gmane.io" To: 47518@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Wed Mar 31 12:20:22 2021 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1lRXxW-000AcZ-5h for geb-bug-gnu-emacs@m.gmane-mx.org; Wed, 31 Mar 2021 12:20:22 +0200 Original-Received: from localhost ([::1]:32920 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lRXxV-0001Qw-6C for geb-bug-gnu-emacs@m.gmane-mx.org; Wed, 31 Mar 2021 06:20:21 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:56614) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lRXsM-0004gw-E9 for bug-gnu-emacs@gnu.org; Wed, 31 Mar 2021 06:15:02 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:41967) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lRXsM-0006aL-3Z for bug-gnu-emacs@gnu.org; Wed, 31 Mar 2021 06:15:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1lRXsL-00043w-Uf for bug-gnu-emacs@gnu.org; Wed, 31 Mar 2021 06:15:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: David Fussner Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Wed, 31 Mar 2021 10:15:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 47518 X-GNU-PR-Package: emacs X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Original-Received: via spool by submit@debbugs.gnu.org id=B.161718568415571 (code B ref -1); Wed, 31 Mar 2021 10:15:01 +0000 Original-Received: (at submit) by debbugs.gnu.org; 31 Mar 2021 10:14:44 +0000 Original-Received: from localhost ([127.0.0.1]:53513 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lRXs3-000435-Ok for submit@debbugs.gnu.org; Wed, 31 Mar 2021 06:14:44 -0400 Original-Received: from lists.gnu.org ([209.51.188.17]:48796) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lRXs0-00042w-Dl for submit@debbugs.gnu.org; Wed, 31 Mar 2021 06:14:43 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:56576) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lRXs0-00041v-6M for bug-gnu-emacs@gnu.org; Wed, 31 Mar 2021 06:14:40 -0400 Original-Received: from mail-qk1-x729.google.com ([2607:f8b0:4864:20::729]:46706) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lRXrw-0006JE-PW for bug-gnu-emacs@gnu.org; Wed, 31 Mar 2021 06:14:39 -0400 Original-Received: by mail-qk1-x729.google.com with SMTP id z10so18744709qkz.13 for ; Wed, 31 Mar 2021 03:14:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlemail.com; s=20161025; h=mime-version:from:date:message-id:subject:to; bh=3A0ur1erXvjFDLKO0qEy8VmnT4+pct5uVWVAv74cK2s=; b=VJPSnbnHpIJvCf874s4uV1xpspdyHMBWQPLpvm2ahhtB5YbDbcj0TL5OO/MNxTqi3W 31FYte+2oZKvJAH0JR64BlYka54R2+aKD6vVjEfqAcAyZzCxUsnwiQN+jO8EtJrhxZaG iZm7TMAVHpzqmzvPdVzf++LezDADoBKdbgwqVLkBME7BzUq74DadjvgWDAm2lC6CC5hq ChTzBeOUmDyqjd8O5NkPtfOv3S/amyNFv6la0Lq8H519KVQqXXJphnRKDzXebbhGvWOj bhXgiqRDGxgcQWNMWQF9c3ghK1er5v4h5MUOriSBnHItyG+oy9+WsqRga+2TRIpGgQeu 4I0w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:from:date:message-id:subject:to; bh=3A0ur1erXvjFDLKO0qEy8VmnT4+pct5uVWVAv74cK2s=; b=j7bv3bv4MSXSFe92zAnM0Wl2IzTzkSGSLfS/GDLtrPMPwHtpMdET0RTZVI6+9usJpx yTS29EzR96kZIOwdaocMd8txonlNjq7EEMxP09GOXa5uMt4PRSg9eDIkDjouIbLtlIGg BMd5693GFsS7Jg82zBk6jv83AihZOFsNrLCV9NWI1tW8fCDNzzHFTev3cIWtXZC/VvGy iq2K/r8TX2DfnVD//NoEyehVgDkyX1Nea9+kJKk93eCXFPzUYQB8Ln5vAAL9fboj2UaY Y2JnEscVZcXijobcVA9aIp0HY3TvjWE1Ny6SPFBz3NjboKjBtPj2mFFOhws2ewgWC4Lu YQwg== X-Gm-Message-State: AOAM532pdmj+DTTJHbvjbMIbQnVVS1EUPVWQdxTH3AIcRny16/gcnhSJ o+bXyZDK0lM+R8O7ZNWqQgrIaCCUTdBSINDGN/+e7F3Qlreutg== X-Google-Smtp-Source: ABdhPJxPZFizGCuEZxfK28UJZWcvRm+GmVHQWoGplShYjDG6INlUEiGCBigpJRN/JFN9m9/LnAAtY+hZrEOda5PvFe0= X-Received: by 2002:a37:7e87:: with SMTP id z129mr2415874qkc.243.1617185674894; Wed, 31 Mar 2021 03:14:34 -0700 (PDT) Received-SPF: pass client-ip=2607:f8b0:4864:20::729; envelope-from=dfussner@googlemail.com; helo=mail-qk1-x729.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.io gmane.emacs.bugs:203341 Archived-At: 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 . */ +#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