Is this a compiler bug?

Dimitry Andric dim at FreeBSD.org
Mon Sep 22 05:51:16 UTC 2014


On 22 Sep 2014, at 04:20, Rui Paulo <rpaulo at me.com> wrote:
> On Sep 21, 2014, at 18:48, Steve Kargl <sgk at troutmask.apl.washington.edu> wrote:
>> On Sun, Sep 21, 2014 at 06:38:48PM -0700, Rui Paulo wrote:
>>> On Sep 21, 2014, at 18:19, Steve Kargl <sgk at troutmask.apl.washington.edu> wrote:
>>>> 
>>>> #include <stdio.h>
>>>> #include <stdint.h>
>>>> 
>>>> int
>>>> main(void)
>>>> {
>>>> 	uint16_t i;
>>>> 	i = 0x3ff0+63; printf("%x\n", i);
>>>> 	i = 0x3ff1+63; printf("%x\n", i);
>>>> 	i = 0x3ff2+63; printf("%x\n", i);
>>>> 	i = 0x3ff3+63; printf("%x\n", i);
>>>> 	i = 0x3ff4+63; printf("%x\n", i);
>>>> 	i = 0x3ff4+63; printf("%x\n", i);
>>>> 	i = 0x3ff6+63; printf("%x\n", i);
>>>> 	i = 0x3ff7+63; printf("%x\n", i);
>>>> 	i = 0x3ff8+63; printf("%x\n", i);
>>>> 	i = 0x3ff9+63; printf("%x\n", i);
>>>> 	i = 0x3ffa+63; printf("%x\n", i);
>>>> 	i = 0x3ffb+63; printf("%x\n", i);
>>>> 	i = 0x3ffc+63; printf("%x\n", i);
>>>> 	i = 0x3ffd+63; printf("%x\n", i);
>>>> 	i = 0x3ffe+63; printf("%x\n", i);
>>>> 	i = 0x3fff+63; printf("%x\n", i);
>>>> 	return 0;
>>>> }
>>> 
>>> Looks like it.  Please file a bug report with LLVM.
>>> 
>> 
>> Unfortunately, llvm requires an account to report bugs.
> 
> I think I know what's happening:  "e" is being parsed as scientific notation.

Yes, this is an unfortunate side effect of hexadecimal float notation
(either in C99, or as a gcc extension [1]).

-Dimitry

[1] https://gcc.gnu.org/onlinedocs/gcc/Hex-Floats.html

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 203 bytes
Desc: Message signed with OpenPGP using GPGMail
URL: <http://lists.freebsd.org/pipermail/freebsd-toolchain/attachments/20140922/546c0f54/attachment.sig>


More information about the freebsd-toolchain mailing list