[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Overflow protection in _AC_COMPUTE_INT_COMPILE

From: Pavel Roskin
Subject: Re: Overflow protection in _AC_COMPUTE_INT_COMPILE
Date: Thu, 16 Nov 2000 17:19:31 -0500 (EST)

Hello, Kaveh!

>  >         int foo[4 == sizeof(int)]
>  >
>  > (well, at least we know that the full formula is always rejected even
>  > if it resolves to a valid size).

Too bad I don't have access to the machine where it failed and Alexandre
cannot reproduce the problem :-(

> I haven't seen any problems using the switch trick in gcc, and we
> always use it regardless of whether we are cross compiling or not.

That's very encouraging. At least some people compile GCC because they are
unhappy with the vendor compiler, and yet they don't report problems.

> The switch trick doesn't use any subtraction or multiplication, it
> simply does "case (sizeof(foo) >= sizeof(bar)):", (at least my version
> does.)  So the HP compiler might accept it more easily.


> Note there is one design consideration which may have given gcc a
> break.  The switch test is setup so that compilation failures based on
> losing C compilers come out as a false result on the feature test.
> Also gcc does a 3-stage bootstrap, we override the macro setting in
> stage2 and stage3 when we know we have gcc so the test eventually gets
> the "right" answer regardless of what answer it got in stage1 with
> possible buggy C compilers.  I don't know if this was a factor or not.

I believe that some values may have been determined incorrectly. The
3-stage bootstrap may have hidden some of those failures.

> I suggest trying the switch method on the hp compiler which reported
> the problem.  Make sure to setup autoconf so that compilation failures
> indicate a false feature test result.

That's exactly what I'm going to do. I think we should install my overflow
protection with "exit 1", so that possible failures are identified as such
in the testsuite. The patch will be available shortly.

> PS: please update the AC_C_LONG_DOUBLE to use some sort of compile
> time test.  That's the test we overrode in gcc in the first place.  I
> looked in aclang.m4 in CVS and it's still using a RUN test.  You can
> copy what's in gcc/aclocal.m4 if you want.

Actually, I think we should try to use _AC_COMPUTE_INT whenever possible.

Pavel Roskin

reply via email to

[Prev in Thread] Current Thread [Next in Thread]