Opened 14 years ago

Last modified 9 years ago

#186 closed bug (fixed)

Bad sparc Int64 code via NCG with -O — at Version 2

Reported by: nobody Owned by: nobody
Priority: low Milestone:
Component: Compiler (NCG) Version: 6.0.1
Keywords: Cc:
Operating System: Unknown/Multiple Architecture: sparc
Type of failure: None/Unknown Test Case:
Blocked By: Blocking:
Related Tickets: Differential Rev(s):
Wiki Page:

Description (last modified by simonmar)

On sparc machines ( sparc-sun-solaris2.6,
sparc-unknown-openbsd ) testsuite tests exercising
Int64 code are broken when compiled the optasm way.
This includes the arith011 test and the enum02 test,
possibly others. Trivial Int64 code will produce
erroneous results. Turning off optimisation, or
compiling via C, will generate correct code. 

Some examples.. 

This one comes from enum02:

  import Int
  main = do print $ pred (1 :: Int64)

$ ./a.out 

which is UINT_MAX...
And from arith011, this generates incorrect results:

  import Int
  main = do print $ take 10 [ (0::Int64), toEnum 2 .. ]

on x86:
on sparc:

which is 2 * (UNIT_MAX + 1), and then twice that.
This erroneously generates an infinte sequence, filling
up /usr on my system before I realised what happened:

  import Int
  main = do print [ (0::Int64) .. toEnum 2 ]

-- Don Stewart

Change History (2)

comment:1 Changed 13 years ago by simonmar

Logged In: YES 

Lowering priority; the native code generator in 6.4 doesn't
support sparc any more.  Any volunteers?

comment:2 Changed 12 years ago by simonmar

Architecture: sparc
Description: modified (diff)
Operating System: Unknown
Note: See TracTickets for help on using tickets.