Go patch committed: Provide matherr function

Rainer Orth ro@CeBiTec.Uni-Bielefeld.DE
Thu Feb 9 18:08:00 GMT 2012


Ian Lance Taylor <iant@google.com> writes:

>> Unfortunately, this breaks the libgo build on Solaris 8 and 9:
>>
>> /vol/gcc/src/hg/trunk/local/libgo/runtime/go-matherr.c: In function 'matherr':
>> /vol/gcc/src/hg/trunk/local/libgo/runtime/go-matherr.c:38:17: error: 'NAN' undeclared (first use in this function)
>> /vol/gcc/src/hg/trunk/local/libgo/runtime/go-matherr.c:38:17: note: each undeclared identifier is reported only once for each function it appears in
>> /vol/gcc/src/hg/trunk/local/libgo/runtime/go-matherr.c:68:28: error: 'INFINITY' undeclared (first use in this function)
>> make[4]: *** [go-matherr.lo] Error 1
>>
>> I couldn't find an appproprite replacement in the system headers.
>
> Hmmm, INFINITY and NAN are in C99.

True, but full C99 support was only introduced in Solaris 10.

> Does it work to do something like
>
> #ifndef INFINITY
> #define INFINITY (1.0 / 0.0)
> #endif
>
> #ifndef NAN
> #define NAN (0.0 / 0.0)
> #endif
>
> ?

I could give it a try once the current bootstraps are finished.  For the
moment I've shamelessly adapted the following from the __GNUC__ section
of Solaris 11 <iso/math_c99.h>:

-------------- next part --------------
A non-text attachment was scrubbed...
Name: libgo-inf-nan.patch
Type: text/x-patch
Size: 398 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20120209/b4c8f8ff/attachment.bin>
-------------- next part --------------

> Another possibility for NAN would to call nan(), if that is available.

It's not, unfortunately.

	Rainer

-- 
-----------------------------------------------------------------------------
Rainer Orth, Center for Biotechnology, Bielefeld University


More information about the Gcc-patches mailing list