Opened 9 years ago

Closed 9 years ago

#3153 closed merge (wontfix)

Panic on syntactically wrong LANGUAGE pragma

Reported by: b_jonas Owned by: igloo
Priority: normal Milestone: 6.10 branch
Component: Compiler Version: 6.10.2
Keywords: Cc:
Operating System: Linux Architecture: x86_64 (amd64)
Type of failure: None/Unknown Test Case:
Blocked By: Blocking:
Related Tickets: Differential Rev(s):
Wiki Page:

Description

I'm getting a panic from runghc. The program I'm compiling has a syntax error in the LANGUAGE pragma, but I still think I should get an error message instead of a panic.

I'm using ghc-6.10.2 compiled from vanilla sources (with extralibs and a few options in build.mk) on an amd64 debian etch linux system.

Below you can see a transscript of the compilation including the panic message, and the source code.

[am]king ~/a/tmp$ runghc Bug
ghc: panic! (the 'impossible' happened)
  (GHC version 6.10.2 for x86_64-unknown-linux):
	getOptions'.parseLanguage(2) went past eof token

Please report this as a GHC bug:  http://www.haskell.org/ghc/reportabug

1[am]king ~/a/tmp$ cat Bug.hs
{-# LANGUAGE - #-}
main = return ();
[am]king ~/a/tmp$ cat -A Bug.hs
{-# LANGUAGE - #-}$
main = return ();$
[am]king ~/a/tmp$ gcc -v
Using built-in specs.
Target: x86_64-unknown-linux-gnu
Configured with: ../gcc-4.3.3/configure --enable-languages=c,c++
Thread model: posix
gcc version 4.3.3 (GCC) 
[am]king ~/a/tmp$ runghc -v -dcore-lint Bug
Glasgow Haskell Compiler, Version 6.10.2, for Haskell 98, stage 2 booted by GHC version 6.10.1
Using package config file: /usr/local/ghc/lib/ghc-6.10.2/./package.conf
hiding package base-3.0.3.1 to avoid conflict with later version base-4.1.0.0
wired-in package ghc-prim mapped to ghc-prim-0.1.0.0
wired-in package integer mapped to integer-0.1.0.1
wired-in package base mapped to base-4.1.0.0
wired-in package rts mapped to rts-1.0
wired-in package haskell98 mapped to haskell98-1.0.1.0
wired-in package syb mapped to syb-0.1.0.1
wired-in package template-haskell mapped to template-haskell-2.3.0.1
wired-in package dph-seq mapped to dph-seq-0.3
wired-in package dph-par mapped to dph-par-0.3
Hsc static flags: -ignore-dot-ghci -static
Loading package ghc-prim ... linking ... done.
Loading package integer ... linking ... done.
Loading package base ... linking ... done.
*** Chasing dependencies:
Chasing modules from: 
Stable obj: []
Stable BCO: []
unload: retaining objs []
unload: retaining bcos []
Ready for upsweep []
Upsweep completely successful.
*** Deleting temp files:
Deleting: 
*** Chasing dependencies:
Chasing modules from: *Bug.hs
ghc: panic! (the 'impossible' happened)
  (GHC version 6.10.2 for x86_64-unknown-linux):
	getOptions'.parseLanguage(2) went past eof token

Please report this as a GHC bug:  http://www.haskell.org/ghc/reportabug

*** Deleting temp files:
Deleting: 
*** Deleting temp dirs:
Deleting: 
1[am]king ~/a/tmp$ 

(I found this bug when I tried to start a program with {-# LANGUAGE -XPatternGuards #-}.)

Change History (8)

comment:1 Changed 9 years ago by igloo

difficulty: Unknown
Owner: set to igloo

Thanks for the report. I see what's going on, and will fix it.

comment:2 Changed 9 years ago by basvandijk

By accident I also ran into this bug with the following code:

{-# LANGUAGE MultiParamTypeClasses # -}
module Main where
main = print "Hello World"

comment:3 Changed 9 years ago by guest

An even simpler test case is

{-# LANGUAGE
#-}

comment:4 Changed 9 years ago by simonmar

Milestone: 6.12.1
Owner: changed from igloo to simonmar

probably my fault.

comment:5 Changed 9 years ago by simonmar

Milestone: 6.12.16.10 branch
Owner: changed from simonmar to igloo
Type: bugmerge

Fixed:

Tue Apr 21 02:45:58 PDT 2009  Simon Marlow <marlowsd@gmail.com>
 * FIX #3153: we lost an EOF sentinel in the event of a lexical error

comment:6 Changed 9 years ago by jff

Reading the history, it seems that the bug is now fixed. However, I can still replicate it with ghc 6.10.3

Thanks, Joao

comment:7 in reply to:  6 Changed 9 years ago by simonmar

Replying to jff:

Reading the history, it seems that the bug is now fixed. However, I can still replicate it with ghc 6.10.3

The fix wasn't merged. It's not a high-priority fix because it's not breaking any essential functionality, and the further down the stable branch we get, the more cautious we are about merging fixes.

comment:8 Changed 9 years ago by igloo

Resolution: wontfix
Status: newclosed

We won't be merging non-essential fixes into the 6.10 branch any more.

Note: See TracTickets for help on using tickets.