On Sat, Aug 12, 2017 at 9:57 AM, Ryan Libby <rli...@freebsd.org> wrote:
> On Sat, Aug 12, 2017 at 9:26 AM, Ian Lepore <i...@freebsd.org> wrote:
>> On Fri, 2017-08-11 at 22:41 +0000, Ryan Libby wrote:
>>> Author: rlibby
>>> Date: Fri Aug 11 22:41:24 2017
>>> New Revision: 322418
>>> URL: https://svnweb.freebsd.org/changeset/base/322418
>>>
>>> Log:
>>>   lib/msun: avoid referring to broken LDBL_MAX
>>>
>>>   LDBL_MAX is broken on i386:
>>>   https://lists.freebsd.org/pipermail/freebsd-numerics/2012-September
>>> /000288.html
>>>
>>>   Gcc has produced +Infinity for LDBL_MAX on i386 and amd64 with -m32
>>>   for some time, and newer versions of gcc are now warning that the
>>>   "floating constant exceeds range of 'long double'".  Avoid this by
>>>   referring to half the value of LDBL_MAX instead.
>>>
>>>   Reviewed by:        bde
>>>   Approved by:        markj (mentor)
>>>   Sponsored by:       Dell EMC Isilon
>>>
>>
>> I now get this error when building toolchain for sparc:
>>
>> cc -isystem 
>> /b/staging/freebsd/head/obj/sparc64.sparc64/b/staging/freebsd/head/src/tmp/usr/include
>>  -L/b/staging/freebsd/head/obj/sparc64.spar
>> c64/b/staging/freebsd/head/src/tmp/usr/lib 
>> -B/b/staging/freebsd/head/obj/sparc64.sparc64/b/staging/freebsd/head/src/tmp/usr/lib
>>  --sysroot=/b/
>> staging/freebsd/head/obj/sparc64.sparc64/b/staging/freebsd/head/src/tmp 
>> -B/b/staging/freebsd/head/obj/sparc64.sparc64/b/staging/freebsd/head/
>> src/tmp/usr/bin -fPIC -DPIC -g -O2 -pipe 
>> -I/b/staging/freebsd/head/src/lib/msun/ld128 
>> -I/b/staging/freebsd/head/src/lib/msun/sparc64 -I/b/sta
>> ging/freebsd/head/src/lib/msun/src 
>> -I/b/staging/freebsd/head/src/lib/libc/include  
>> -I/b/staging/freebsd/head/src/lib/libc/sparc64   -MD  -MF.
>> depend.catrigl.pico -MTcatrigl.pico -std=gnu99 -fstack-protector-strong 
>> -Wsystem-headers -Werror -Wno-pointer-sign -Wno-unknown-pragmas     -
>> c /b/staging/freebsd/head/src/lib/msun/src/catrigl.c -o catrigl.pico
>> /b/staging/freebsd/head/src/lib/msun/src/catrigl.c:310:1: error: pasting 
>> "0x0.8p" and "(" does not give a valid preprocessing token
>> /b/staging/freebsd/head/src/lib/msun/src/catrigl.c:310:1: error: exponent 
>> has no digits
>> /b/staging/freebsd/head/src/lib/msun/src/catrigl.c:310:1: error: pasting ")" 
>> and "L" does not give a valid preprocessing token
>> /b/staging/freebsd/head/src/lib/msun/src/catrigl.c: In function 
>> 'clog_for_large_values':
>> /b/staging/freebsd/head/src/lib/msun/src/catrigl.c:310: error: expected ')' 
>> before 'L'
>> *** [catrigl.pico] Error code 1
>
> Thanks, I see it.  It also shows up on the sparc64 ci build [1].  Let me
> see if I can find a quick fix, else I guess we can just back it out for
> now.
>
> [1] https://ci.freebsd.org/job/FreeBSD-head-sparc64-build/2534/

A few possible quick fixes:

 - Change the {arm64,riscv,sparc64}/include/float.h LDBL_MAX_EXP
   definitions from (+16384) to 16384.

 - Change HALF_LDBL_MAX from
#define HALF_LDBL_MAX __CONCAT(__CONCAT(0x0.8p, LDBL_MAX_EXP), L)
   to
#if LDBL_MAX_EXP != 0x4000
#error "Unsupported long double format"
#endif
#define HALF_LDBL_MAX 0x0.8p16384L

 - Change the HALF_LDBL_MAX constant to a variable constructed with
   LD80C(), I think with
LD80C(0x8000000000000000, 16383, 5.9486574767861588254e+4931L)
   but this also requires #error for LDBL_MAX_EXP != 0x4000, so not
   really any better than the above.

I think I will back the patch out for now and go back to review.
_______________________________________________
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"

Reply via email to