implicit declarations in acinclude.m4

Marc Glisse marc.glisse at inria.fr
Mon Mar 31 18:26:04 UTC 2014


On Mon, 31 Mar 2014, Torbjorn Granlund wrote:

> Marc Glisse <marc.glisse at inria.fr> writes:
>
>  the tests in acinclude.m4 are often not correct C (they are not
>  supposed to be, that's ok), but some stricter C99 compilers are
>  unhappy about that. The main issue seems to be implicit
>  declarations. There are many exit(0) where exit is not declared (and
>  stdlib.h is not included) that could probably be replaced with return
>  0. The test for -lm uses log without including math.h.
> 
> How unhappy are thos compilers?

Enough to error out right there.

>  Harder are the 2 long long reliability tests. They are for Apple's gcc
>  3.3 with -mpowerpc64 and either -O1 or -O2, so it is tempting to just
>  remove them (according to the comment, the compiler crashes, it isn't
>  producing wrong code or anything hard to notice like that). It would
>  be possible to move the definitions of g and h earlier in the test,
>  but I have no way to check if that still triggers the bug. I could
>  also update the test on __GNUC__ to check that it is <=3 and skip the
>  weird code for more recent versions (as is already done for C++).
> 
> I think the problem compiler might be available at g5.gmplib.org (and
> you seem to have an account there).

Nice, I just checked and I can reproduce! If I replace the late definition 
by an early declaration (not definition), it still crashes for both tests.

-- 
Marc Glisse


More information about the gmp-bugs mailing list