RE: Failed to find interface decl for `Offside.a1' with -O2

2002-01-03 Thread Simon Peyton-Jones

A palpable bug, thank you.   Workaround: don't use -O2 when
compiling Offside.  It'll be fixed in 5.02.2

Simon

| -Original Message-
| From: Ian Lynagh [mailto:[EMAIL PROTECTED]] 
| Sent: 28 December 2001 23:13
| To: [EMAIL PROTECTED]
| Subject: Failed to find interface decl for `Offside.a1' with -O2
| 
| 
| 
| Hi guys,
| 
| I'm afraid I haven't got a simple test case for this one.
| 
| ghc is giving me the error
| Failed to find interface decl for `Offside.a1'
| in a rather large program. I have shown how to reproduce the 
| problem below (indenting the output). The code, compiled as 
| shown below, is at http://c93.keble.ox.ac.uk/~ian/igl-0.0.8-b1.tar.gz
| 
| $ hmake -ghc Project -package lang -O2
| ghc  -package lang -O2   -c -o Tokens.o Tokens.lhs
| ghc  -package lang -O2   -c -o Tree.o Tree.lhs
| ghc  -package lang -O2   -c -o Subject.o Subject.lhs
| ghc  -package lang -O2   -c -o PPTeX.o PPTeX.lhs
| ghc  -package lang -O2   -c -o Position.o Position.lhs
| ghc  -package lang -O2   -c -o Either.o Either.lhs
| ghc  -package lang -O2   -c -o PCbase.o PCbase.lhs
| ghc  -package lang -O2   -c -o PC.o PC.lhs
| ghc  -package lang -O2   -c -o Parser.o Parser.lhs
| ghc  -package lang -O2   -c -o Mangle.o Mangle.lhs
| ghc  -package lang -O2   -c -o Sort.o Sort.lhs
| ghc  -package lang -O2   -c -o FiniteMap.o FiniteMap.lhs
| ghc  -package lang -O2   -c -o IA.o IA.lhs
| ghc  -package lang -O2   -c -o Offside.o Offside.lhs
| 
| Offside.lhs:116: Warning: Pattern match(es) are overlapped
| In the definition of `step': step _ pos [] _ = ...
| ghc  -package lang -O2   -c -o Scanner.o Scanner.lhs
| ghc  -package lang -O2   -c -o Args.o Args.lhs
| ghc  -package lang -O2   -c -o Project.o Project.lhs
| 
| Project.lhs:4:
| Failed to find interface decl for `Offside.a1'
| from module `Offside'
| 
| Project.lhs:4:
| Failed to find interface decl for `Offside.a3'
| from module `Offside'
| $ ghc  -package lang -O   -c -o Project.o Project.lhs
| 
| Project.lhs:4:
| Failed to find interface decl for `Offside.a1'
| from module `Offside'
| 
| Project.lhs:4:
| Failed to find interface decl for `Offside.a3'
| from module `Offside'
| $ ghc  -package lang   -c -o Project.o Project.lhs
| $ 
| 
| 
| Thanks
| Ian
| 
| 
| ___
| Glasgow-haskell-bugs mailing list 
| [EMAIL PROTECTED] 
| http://www.haskell.org/mailman/listinfo/glasgow-| haskell-bugs
| 

___
Glasgow-haskell-bugs mailing list
[EMAIL PROTECTED]
http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs



incorrect parsing

2002-01-03 Thread Malcolm Wallace

This program:

module Main where
f = map (++a++b)
g = map (a++b++)
main = do print (f [x,y,z])
  print (g [x,y,z])

gives the following error messages with ghc (versions 4.08.2 and 5.02):

plusplus.hs:3:
The operator `++' [infixr 5] of a section
must have lower precedence than the operand `++' [infixr 5]
In the section: `(++ (a ++ b))'

plusplus.hs:4:
The operator `++' [infixr 5] of a section
must have lower precedence than the operand `++' [infixr 5]
In the section: `((a ++ b) ++)'

I believe this is the wrong behaviour - the first (right) section is
perfectly valid Haskell'98 because the operator is right associative.
Hugs, hbc, and nhc98 all accept it.  Check also section 3.5 (p.17)
of the Report.

The second (left) section is indeed incorrect, again because the
operator is right associative.

Regards,
Malcolm

___
Glasgow-haskell-bugs mailing list
[EMAIL PROTECTED]
http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs



Re: incorrect parsing

2002-01-03 Thread Ian Lynagh

On Thu, Jan 03, 2002 at 05:10:56PM +, Malcolm Wallace wrote:
 This program:
 
 module Main where
 f = map (++a++b)
 g = map (a++b++)
 main = do print (f [x,y,z])
   print (g [x,y,z])
 
 gives the following error messages with ghc (versions 4.08.2 and 5.02):
 
 plusplus.hs:3:
 The operator `++' [infixr 5] of a section
 must have lower precedence than the operand `++' [infixr 5]
 In the section: `(++ (a ++ b))'
 
 I believe this is the wrong behaviour - the first (right) section is
 perfectly valid Haskell'98 because the operator is right associative.
 Hugs, hbc, and nhc98 all accept it.  Check also section 3.5 (p.17)
 of the Report.

The context free grammar in appendix B (and at the start of section 3)
defines right sections as
( qop(a,i) expi+1 )
which contradicts 3.5. The additional production to
( qop(r,i) rexpi )
could be added, and similarly for left sections.

The brackets added to the error would make the section valid anyway
which should perhaps be fixed regardless.


Thanks
Ian


___
Glasgow-haskell-bugs mailing list
[EMAIL PROTECTED]
http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs



RE: incorrect parsing

2002-01-03 Thread Simon Marlow


 This program:
 
 module Main where
 f = map (++a++b)
 g = map (a++b++)
 main = do print (f [x,y,z])
   print (g [x,y,z])
 
 gives the following error messages with ghc (versions 4.08.2 
 and 5.02):
 
 plusplus.hs:3:
 The operator `++' [infixr 5] of a section
 must have lower precedence than the operand `++' 
 [infixr 5]
 In the section: `(++ (a ++ b))'
 
 plusplus.hs:4:
 The operator `++' [infixr 5] of a section
 must have lower precedence than the operand `++' 
 [infixr 5]
 In the section: `((a ++ b) ++)'
 
 I believe this is the wrong behaviour - the first (right) section is
 perfectly valid Haskell'98 because the operator is right associative.
 Hugs, hbc, and nhc98 all accept it.  Check also section 3.5 (p.17)
 of the Report.
 
 The second (left) section is indeed incorrect, again because the
 operator is right associative.

The text of section 3.5 seems to disagree with the syntax.  The syntax
says that these sections are allowed:

'(' exp(i+1) op(a,i) ')'
'(' op(a,i) exp(i+1) ')'

Which looks like the rule that GHC is implementing: the precedence of
the operator must be strictly lower than that of the expression.

I think it would be better to change the syntax to match the text rather
than the other way around: clearly sections like (++a++b) are desirable.
If I understand the notation in the report correctly, I think adding
these two productions to aexp would do the trick:

'(' lexp(i) op(l,i) ')'
'(' op(r,i) rexp(i) ')'

And for the sake of fewer ambiguities, replace each op(a,i) with op(n,i)
in the existing two section productions.

Cheers,
Simon

___
Glasgow-haskell-bugs mailing list
[EMAIL PROTECTED]
http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs