[GHC] #10518: unregisterised GHC generates incorrect 0xUL literals for certain onstants

GHC ghc-devs at haskell.org
Sat Jun 13 22:19:49 UTC 2015


#10518: unregisterised GHC generates incorrect 0xUL literals for certain onstants
-------------------------------------+-------------------------------------
        Reporter:  slyfox            |                   Owner:  slyfox
            Type:  bug               |                  Status:  new
        Priority:  normal            |               Milestone:
       Component:  Compiler          |                 Version:  7.10.1
      Resolution:                    |                Keywords:
Operating System:  Unknown/Multiple  |            Architecture:
 Type of failure:  None/Unknown      |  Unknown/Multiple
      Blocked By:                    |               Test Case:
 Related Tickets:                    |                Blocking:
                                     |  Differential Revisions:
-------------------------------------+-------------------------------------
Description changed by int-e:

Old description:

> jakzale reports:
> 21:47:27 < int-e> Oh, nice. Yes, indeed pprHexVal (2^32) W32 (function
> from cmm/PprC.hs) would result in 0xU.
> 21:50:29 < jakzale> int-e: yes, truncInt takes module 2^32, then go
> returns empty string (I guess)
>
> Here comes the test:
> {{{
> $ cat a.cmm
>
> foo() {
>     bits64 a;
>     a = 0x10000000000000000; // overflows 64 bits
>     return (a);
> }
>
> $ inplace/bin/ghc-stage2 -c a.cmm
> /tmp/ghc8580_0/ghc_2.hc: In function 'foo':
>
> /tmp/ghc8580_0/ghc_2.hc:8:7: error:
>      error: invalid suffix "xUL" on integer constant
>      _c0 = 0xUL;
>            ^
> }}}
> I've broke it with commit:43f1b2ecd1960fa7377cf55a2b97c66059a701ef
> when introduced truncation that can generate more zeroes.

New description:

 jakzale reports:
 21:47:27 < int-e> Oh, nice. Yes, indeed pprHexVal (2^32^) W32 (function
 from cmm/PprC.hs) would result in 0xU.
 21:50:29 < jakzale> int-e: yes, truncInt takes module 2^32^, then go
 returns empty string (I guess)

 Here comes the test:
 {{{
 $ cat a.cmm

 foo() {
     bits64 a;
     a = 0x10000000000000000; // overflows 64 bits
     return (a);
 }

 $ inplace/bin/ghc-stage2 -c a.cmm
 /tmp/ghc8580_0/ghc_2.hc: In function 'foo':

 /tmp/ghc8580_0/ghc_2.hc:8:7: error:
      error: invalid suffix "xUL" on integer constant
      _c0 = 0xUL;
            ^
 }}}
 I've broke it with commit:43f1b2ecd1960fa7377cf55a2b97c66059a701ef
 when introduced truncation that can generate more zeroes.

--

--
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/10518#comment:2>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler


More information about the ghc-tickets mailing list