Bug 1419536

Summary: FTBFs with GCC 7
Product: [Fedora] Fedora Reporter: Marek Polacek <mpolacek>
Component: diffutilsAssignee: Tim Waugh <twaugh>
Status: CLOSED DUPLICATE QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: rawhideCC: b38617, twaugh
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2017-02-21 16:18:16 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Marek Polacek 2017-02-06 13:06:48 UTC
diffutils-3.5-1.fc26 fails to build with GCC 7:

In file included from inttostr.h:23:0,
                 from anytostr.c:29,
                 from imaxtostr.c:3:
intprops.h:234:34: error: expected ')' before '(' token
    __builtin_add_overflow (a, b, (__typeof__ ((a) + (b)) *) 0)
                                  ^

The problem is that intprops.h has

/* True if __builtin_add_overflow (A, B, P) works when P is null.  */
#define _GL_HAS_BUILTIN_OVERFLOW_WITH_NULL (7 <= __GNUC)

which is now true, and so the following patch is needed to make this compile:

--- lib/intprops.h.mp	2017-02-06 13:58:56.544961027 +0100
+++ lib/intprops.h	2017-02-06 14:00:10.704026941 +0100
@@ -230,11 +230,11 @@ verify (TYPE_MAXIMUM (long long int) ==
    (e.g., A and B) have the same type as MIN and MAX.  Instead, they assume
    that the result (e.g., A + B) has that type.  */
 #if _GL_HAS_BUILTIN_OVERFLOW_WITH_NULL
-# define _GL_ADD_OVERFLOW(a, b, min, max)
+# define _GL_ADD_OVERFLOW(a, b, min, max)				 \
    __builtin_add_overflow (a, b, (__typeof__ ((a) + (b)) *) 0)
-# define _GL_SUBTRACT_OVERFLOW(a, b, min, max)
+# define _GL_SUBTRACT_OVERFLOW(a, b, min, max)				 \
    __builtin_sub_overflow (a, b, (__typeof__ ((a) - (b)) *) 0)
-# define _GL_MULTIPLY_OVERFLOW(a, b, min, max)
+# define _GL_MULTIPLY_OVERFLOW(a, b, min, max)				 \
    __builtin_mul_overflow (a, b, (__typeof__ ((a) * (b)) *) 0)
 #else
 # define _GL_ADD_OVERFLOW(a, b, min, max)                                \

Comment 1 Tim Waugh 2017-02-06 16:32:35 UTC
Hmm, I also get this after fixing the line continuations:

../lib/intprops.h:234:4: error: expression in static assertion is not constant

Might be a gnulib issue.

Comment 2 Account closed by the user 2017-02-07 21:47:32 UTC
Maybe already fixed upstream: http://git.savannah.gnu.org/cgit/diffutils.git/log/

Comment 3 Tim Waugh 2017-02-21 16:18:16 UTC

*** This bug has been marked as a duplicate of bug 1423328 ***