[Bug c/26005] Non-existent function/macro isinf() - correctly rejected by gcc - accepted by gcc -O

dbb at hadenmead dot com gcc-bugzilla@gcc.gnu.org
Sun Jan 29 00:36:00 GMT 2006



------- Comment #7 from dbb at hadenmead dot com  2006-01-29 00:36 -------
Please forgive my persistence, but :-

> Again this is a bug in your code/Semi in solaris and not in GCC.

Possibly in Solaris (non-compliance with standard), but the code I have
supplied contains no bugs : the code should simply not compile on a system
which fails to mention isinf() in its header files and does not provide it in
its libraries.

> isinf is a standard function (it does not have to be implemented as a macro).

As far as I can make out, the C standards require isinf() to be defined as a
macro (see http://www.opengroup.org/onlinepubs/009695399/basedefs/math.h.html).

But I don't think that's the point at issue.

If it IS implemented as a function, then it seems to me that if it (or any
other standard function) is not available in the standard libraries at compile
time, then compilation should fail, regardless of the level of optimisation and
regardless of the context in which the function call appears in the code.

The (bug-free) code I have provided shows that success or failure of
compilation with optimisation (under 4.0.2 but not 3.3.2) depends on the
context in which isinf() is called.

> Then autoconf should be more clever, for example by compiling w/o optimization
> or by using a robust test or by passing -fno-builtin to the compiler.

Yes of course these suggestions would work fine, but they would be in the
nature of workarounds.  I was merely trying to illustrate that others also seem
to believe that the absence of a definition (macro or function) and/or the
absence of the function itself should cause a compile-time error.


-- 

dbb at hadenmead dot com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|RESOLVED                    |UNCONFIRMED
         Resolution|INVALID                     |


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=26005



More information about the Gcc-bugs mailing list