Bug#853649: gnulib intprops.h build error with gcc 7

2017-08-17 Thread Adrian Bunk
On Thu, Aug 17, 2017 at 08:40:28PM +0200, Bruno Haible wrote:
>...
> Now about your test case: It is not valid C to try to compile just an
> expression.
>...

I was about to say that this was directly copied from intprops.h

And when double-checking that, I finally realized that this is
what is in intprops.h in rush - but intprops.h in current gnulib
git is fine.

When looking at them I missed that they are different at this relevant 
macro, and that the problem is only in the older intprops.h shipped in 
rush.

Sorry for the confusion
Adrian

-- 

   "Is there not promise of rain?" Ling Tan asked suddenly out
of the darkness. There had been need of rain for many days.
   "Only a promise," Lao Er said.
   Pearl S. Buck - Dragon Seed



Bug#853649: gnulib intprops.h build error with gcc 7

2017-08-17 Thread Bruno Haible
Adrian Bunk wrote:
> For reproducing and my tiny testcase I was using
>   gcc (Debian 7.1.0-13) 7.1.0
> from Debian unstable - that is GCC 7.2 release candidate 2
> with minimal Debian patching.

OK thanks.

Now about your test case: It is not valid C to try to compile just an
expression.

   a + b

is not a valid C compilation unit either. Can you submit a small test case
that
1) makes use of the intprops.h file from gnulib as a whole,
2) compiles with gcc 6 or earlier?

Bruno



Bug#853649: gnulib intprops.h build error with gcc 7

2017-08-17 Thread Adrian Bunk
On Thu, Aug 17, 2017 at 07:02:47PM +0200, Bruno Haible wrote:
> Hi Adrian,
> 
> Could you please give the complete output of "gcc --version"?
> 
> Given that [1] references an URL that contains the string
> 'gcc7-20170126' whereas gcc 7 was released on 2017-05-02 [2],
> it could be that the report is about a gcc prerelease that
> came 3 months before the gcc 7 release.

For reproducing and my tiny testcase I was using
  gcc (Debian 7.1.0-13) 7.1.0
from Debian unstable - that is GCC 7.2 release candidate 2
with minimal Debian patching.

> Bruno
>...

cu
Adrian

-- 

   "Is there not promise of rain?" Ling Tan asked suddenly out
of the darkness. There had been need of rain for many days.
   "Only a promise," Lao Er said.
   Pearl S. Buck - Dragon Seed



Bug#853649: gnulib intprops.h build error with gcc 7

2017-08-17 Thread Bruno Haible
Hi Adrian,

Could you please give the complete output of "gcc --version"?

Given that [1] references an URL that contains the string
'gcc7-20170126' whereas gcc 7 was released on 2017-05-02 [2],
it could be that the report is about a gcc prerelease that
came 3 months before the gcc 7 release.

Bruno

[1] https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=853649
[2] https://gcc.gnu.org/



Bug#853649: gnulib intprops.h build error with gcc 7

2017-08-17 Thread Adrian Bunk
> Package: src:rush
> Version: 1.8+dfsg-1
>...
> In file included from inttostr.h:25:0,
>  from anytostr.c:31,
>  from imaxtostr.c:5:
> intprops.h:236:34: error: expected ')' before '(' token
> __builtin_add_overflow (a, b, (__typeof__ ((a) + (b)) *) 0)
>   ^
> Makefile:1284: recipe for target 'imaxtostr.o' failed
>...

This can be reproduced with

$ cat test.c
# define _GL_ADD_OVERFLOW(a, b, min, max)
   __builtin_add_overflow (a, b, (__typeof__ ((a) + (b)) *) 0)
$ gcc -c test.c
test.c:2:34: error: expected ‘)’ before ‘(’ token
__builtin_add_overflow (a, b, (__typeof__ ((a) + (b)) *) 0)
  ^
$ 


This is a problem in gnulib, introduced by

commit d22721e2efd88f26588c971eb1eeb3ec40de
Author: Paul Eggert 
Date:   Mon Aug 29 10:08:32 2016 -0700

intprops.h: use __typeof__ with GCC 7

* lib/intprops.h (_GL_ADD_OVERFLOW, _GL_SUBTRACT_OVERFLOW)
(_GL_MULTIPLY_OVERFLOW): Use __typeof__ as in the GCC manual.
This avoids computing the expression's value (which might overflow!).


cu
Adrian

-- 

   "Is there not promise of rain?" Ling Tan asked suddenly out
of the darkness. There had been need of rain for many days.
   "Only a promise," Lao Er said.
   Pearl S. Buck - Dragon Seed