Opened 15 years ago

Closed 15 years ago

Last modified 48 years ago

#85 closed bug (Duplicate)

ghc -O generates faulty c code

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


I have the following file:

module Bug where

foo :: Double -> Double
foo x = x - (-1.0) 

> ghc -c -O Bug.hs
/tmp/ghc25320.hc: In function `s3Ny_ret':
/tmp/ghc25320.hc:14: invalid lvalue in decrement
/tmp/ghc25320.hc:14: parse error before `1.0'


The problem is the following generated c snippet


The two consecutive minuses should be separated by a

Ulf Norell

Change History (2)

comment:1 Changed 15 years ago by spanne

Logged In: YES 

I've tested it with 5.02.3, 5.04.1 and the CVS HEAD and it
works fine in all cases (i.e.the literal is correctly
wrapped into parentheses). Which version are you using exactly?

comment:2 Changed 15 years ago by simonmar

Status: assignedclosed
Logged In: YES 

This was fixed in 5.04.1 (also reported in #604849).
Note: See TracTickets for help on using tickets.