ghc -O generates faulty c code
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@cs.chalmers.se
Trac metadata
| Trac field | Value |
|---|---|
| Version | 5.04 |
| Type | Bug |
| TypeOfFailure | OtherFailure |
| Priority | normal |
| Resolution | ResolvedDuplicate |
| Component | Compiler |
| Test case | |
| Differential revisions | |
| BlockedBy | |
| Related | |
| Blocking | |
| CC | |
| Operating system | |
| Architecture |