Is this a compiler bug?

Steve Kargl sgk at troutmask.apl.washington.edu
Mon Sep 22 16:20:36 UTC 2014


On Mon, Sep 22, 2014 at 08:46:07AM +0300, Andriy Gapon wrote:
> On 22/09/2014 05:20, Rui Paulo 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 = 0x3ffe+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.
> 
> Interesting!  One of the cases where the whitespace matters?
> 

In a discussion on a GCC list, I was pointed to the section of
n1256.pdf where preprocessing numbers are discussed.  0x3ffe+63
is preprocessed as a single token.  When the parser finally gets
around to classifying this token, it is neither a valid integer
constant nor floating point constant.  It's just a weird feature
(idiosyncrasy?) of the C language.

-- 
Steve


More information about the freebsd-toolchain mailing list