[ ghc-Bugs-617082 ] ghc -O generates faulty c code

noreply at sourceforge.net noreply at sourceforge.net
Thu Oct 3 08:23:38 EDT 2002


Bugs item #617082, was opened at 2002-10-01 17:47
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=108032&aid=617082&group_id=8032

Category: Compiler
Group: 5.04
Status: Open
Resolution: None
Priority: 5
Submitted By: Nobody/Anonymous (nobody)
Assigned to: Nobody/Anonymous (nobody)
Summary: ghc -O generates faulty c code

Initial Comment:
I have the following file:

Bug.hs
--------------------------
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'

Cause
-----

The problem is the following generated c snippet

_s3Nx_=PK_DBL((W_*)(R1.p+1))--1.0;

The two consecutive minuses should be separated by a
space.

Ulf Norell
ulfn at cs.chalmers.se


----------------------------------------------------------------------

>Comment By: Sven Panne (spanne)
Date: 2002-10-03 14:23

Message:
Logged In: YES 
user_id=50298

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?

----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=108032&aid=617082&group_id=8032



More information about the Glasgow-haskell-bugs mailing list