Ticket #186 (closed bug: fixed)

Opened 10 years ago

Last modified 4 years ago

Bad sparc Int64 code via NCG with -O

Reported by: nobody Owned by: benl
Priority: low Milestone: _|_
Component: Compiler (NCG) Version: 6.0.1
Keywords: Cc:
Operating System: Unknown/Multiple Architecture: sparc
Type of failure: Difficulty: Unknown
Test Case: enum02 Blocked By:
Blocking: Related Tickets:

Description (last modified by simonmar) (diff)

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 
  4294967295

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

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

on x86:
   [0,2,4]
on sparc:
   [0,8589934592,17179869184]

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

Changed 8 years ago by simonmar

Logged In: YES 
user_id=48280

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

Changed 7 years ago by simonmar

  • os set to Unknown
  • architecture set to sparc
  • description modified (diff)

Changed 7 years ago by igloo

  • difficulty set to Unknown
  • milestone set to _|_

Changed 5 years ago by simonmar

  • os changed from Unknown to Unknown/Multiple

Changed 4 years ago by benl

  • owner changed from nobody to benl
  • status changed from assigned to new

Changed 4 years ago by benl

  • testcase set to enum02

Changed 4 years ago by duncan

Changed 4 years ago by benl

  • status changed from new to closed
  • resolution changed from None to fixed
Note: See TracTickets for help on using tickets.