Opened 6 years ago

Closed 6 years ago

#5635 closed bug (fixed)

compiling iteratee with llvm backend fails with panic

Reported by: jwlato Owned by: dterei
Priority: normal Milestone:
Component: Compiler (LLVM) Version: 7.2.1
Keywords: llvm, LlvmMangler, panic Cc:
Operating System: Unknown/Multiple Architecture: Unknown/Multiple
Type of failure: Compile-time crash Test Case:
Blocked By: Blocking:
Related Tickets: Differential Rev(s):
Wiki Page:


When attempting to compile "iteratee-" with ghc-7.2.2 (64 bit, OSX 10.7) and the llvm backend (llvm-2.9), I get the following error:

[11 of 18] Compiling Data.Iteratee.Char ( src/Data/Iteratee/Char.hs, dist/build/Data/Iteratee/Char.p_o )
ghc: panic! (the 'impossible' happened)
  (GHC version 7.2.2 for x86_64-apple-darwin):
	LLvmMangler Cannot read "\nLBB162_12:                              ## %n8HBq\n\tmovzbl\t%al" as it's not an Int

Please report this as a GHC bug:

Attachments (1)

ghc50570_10.lm_s.bz2 (46.5 KB) - added by jwlato 6 years ago.
lm_s file (ghc-7.2.2 x64, LLVM-2.9)

Download all attachments as: .zip

Change History (10)

comment:1 Changed 6 years ago by dterei

Thanks for the report, I'll take a look. I think this may already be fixed on x64 on OS X as the mangler no longer fixes up the stack on that platform. However the bug may be present on 32bit and that will need to be fixed.

comment:2 Changed 6 years ago by dterei

OS Arch GHC LLVM Status
OSX 10.7 64 7.2.1 2.9 Works
OSX 10.7 64 7.2.1 3.0 Works
OSX 10.7 32 7.2.1 2.9 Works
OSX 10.7 32 7.2.1 3.0 Works
OSX 10.7 32 7.0.4 2.9 Fails (mangler)
OSX 10.7 32 7.0.4 3.0 Fails (llvm version unsupported)

So strangely I don't get a failure with 7.2.1 and I'm not aware of any change in 7.2.2 that should cause it. In GHC 7.0.4 I get the same failure

ghc: panic! (the 'impossible' happened)
  (GHC version 7.0.4 for i386-apple-darwin):
	LLvmMangler Cannot read"\nLBB147_10:                              ## %n3xZe\n\tmovzbl\t%cl"as it's not an Int

I'll grab 7.2.2 and test to confirm.

comment:3 Changed 6 years ago by dterei

Hmm, so compiling using OSX 10.7, ghc-7.2.2 (x64) and llvm 2.9 works fine for me. (so does 32bit)

Could you compile again but put '-keep-llvm-files' into the cabal file and then attach the '.ll' file for Data.Iteratee.Char to this ticket please. Also please double check the version of the tools you are using.

You haven't changed the source or the cabal file (other than adding -fllvm) for iteratee in any other way have you?

comment:4 Changed 6 years ago by dterei

Oh also sorry, could you also put '-keep-tmp-files' into the cabal file and then send me the 'lm_s' file that the mangler is actually processing? If you run ghc with '-v' it will make it clear where to find that file.

comment:5 Changed 6 years ago by dterei

Status: newinfoneeded

Changed 6 years ago by jwlato

Attachment: ghc50570_10.lm_s.bz2 added

lm_s file (ghc-7.2.2 x64, LLVM-2.9)

comment:6 Changed 6 years ago by jwlato

Status: infoneedednew

The .ll file is too big to attach, but I've put it at

I haven't changed the iteratee source; I just tried building from a fresh "cabal unpack".

I've double-check the ghc version (7.2.1 x64 and 7.2.2 x64), but is there a good way to check the llvm version? I should only have 2.9 installed, and e.g. llvm-ld --version shows

$ llvm-ld --version
Low Level Virtual Machine (
  llvm version 2.9
  Optimized build.
  Built Nov 15 2011 (03:37:10).
  Host: x86_64-apple-darwin11
  Host CPU: i686

  Registered Targets:

Also, the panic only happens when building with profiling enabled.

comment:7 Changed 6 years ago by dterei

Oh ok, the fact that profiling is enabled is probably what stopped me being able to reproduce. Thanks, I'll check again.

comment:8 Changed 6 years ago by dterei

OK I can confirm now (only triggered in profiling version).

I am in the process of confirming but I think this should already be fixed in HEAD since the job of the mangler has been reduced. See trac #4211.

comment:9 Changed 6 years ago by dterei

Resolution: fixed
Status: newclosed

Fixed in head. Thanks!

Note: See TracTickets for help on using tickets.