#1616: segfault in generated file when using NOINLINE
-------------------------+--------------------------------------------------
    Reporter:  guest     |        Owner:         
        Type:  bug       |       Status:  new    
    Priority:  normal    |    Milestone:  6.8    
   Component:  Compiler  |      Version:  6.6.1  
    Severity:  normal    |   Resolution:         
    Keywords:            |   Difficulty:  Unknown
          Os:  Linux     |     Testcase:         
Architecture:  x86       |  
-------------------------+--------------------------------------------------
Changes (by igloo):

  * milestone:  => 6.8

Old description:

> Compiling and running the attached file produces a segmentation fault.
> The file was originally generated by happy (1.15), but using happy 1.16
> does not help. Removing the {-# NOINLINE happySpecReduce_1 #-} right
> before main solves the problem.
>
> uname -a:
> Linux femtosec 2.6.18-4-486 #1 Wed May 9 22:23:40 UTC 2007 i686 GNU/Linux
>
> gcc -v: gcc version 4.1.2
>
> [EMAIL PROTECTED]:~/shared/kep/Misc/esotools/temp$ ghc -v
> Glasgow Haskell Compiler, Version 6.6.1, for Haskell 98, compiled by GHC
> version 6.6.1
> Using package config file: /home/ctr/tools/lib/ghc-6.6.1/package.conf
> wired-in package base mapped to base-2.1.1
> wired-in package rts mapped to rts-1.0
> wired-in package haskell98 mapped to haskell98-1.0
> wired-in package template-haskell mapped to template-haskell-2.1
> Hsc static flags: -static
> *** Deleting temp files:
> Deleting:
> *** Deleting temp dirs:
> Deleting:
> ghc-6.6.1: no input files
> Usage: For basic information, try the `--help' option.
>

> === The compilation-run ===
> ghc -O2 -dcore-lint -fvia-C -fglasgow-exts -fwarn-missing-signatures
> --make T -o esoT
> [1 of 1] Compiling Main             ( T.hs, T.o )
>
> GenericTemplate.hs:174:0:
>     Warning: Definition but no type signature for `happyShift'
>
> GenericTemplate.hs:184:0:
>     Warning: Definition but no type signature for `happySpecReduce_0'
>
> GenericTemplate.hs:189:0:
>     Warning: Definition but no type signature for `happySpecReduce_1'
>
> GenericTemplate.hs:195:0:
>     Warning: Definition but no type signature for `happySpecReduce_2'
>
> GenericTemplate.hs:201:0:
>     Warning: Definition but no type signature for `happySpecReduce_3'
>
> GenericTemplate.hs:207:0:
>     Warning: Definition but no type signature for `happyReduce'
>
> GenericTemplate.hs:215:0:
>     Warning: Definition but no type signature for `happyMonadReduce'
>
> GenericTemplate.hs:222:0:
>     Warning: Definition but no type signature for `happyDrop'
>
> GenericTemplate.hs:225:0:
>     Warning: Definition but no type signature for `happyDropStk'
>
> GenericTemplate.hs:239:0:
>     Warning: Definition but no type signature for `happyGoto'
>
> GenericTemplate.hs:246:0:
>     Warning: Definition but no type signature for `happyFail'
>
> GenericTemplate.hs:258:0:
>     Warning: Definition but no type signature for `notHappyAtAll'
>
> T.hs:92:0:
>     Warning: Definition but no type signature for `happyReduction_1'
>
> T.hs:98:0:
>     Warning: Definition but no type signature for `happyReduction_2'
>
> T.hs:107:0:
>     Warning: Definition but no type signature for `happyReduction_3'
>
> T.hs:115:0:
>     Warning: Definition but no type signature for `happyNewToken'
>
> T.hs:126:0:
>     Warning: Definition but no type signature for `happyError_'
>
> T.hs:129:0:
>     Warning: Definition but no type signature for `happyIdentity'
>
> T.hs:130:0:
>     Warning: Definition but no type signature for `happyRunIdentity'
>
> T.hs:140:0:
>     Warning: Definition but no type signature for `happyThen1'
>
> T.hs:146:0: Warning: Definition but no type signature for `parse'
>
> T.hs:149:0:
>     Warning: Definition but no type signature for `happySeq'
>
> T.hs:163:0:
>     Warning: Definition but no type signature for `happyParse'
>
> T.hs:171:0:
>     Warning: Definition but no type signature for `happyAccept'
>
> T.hs:120:1:
>     Warning: Pattern match(es) are overlapped
>              In a case alternative: _ -> ...
> Linking esoT ...
>
> [EMAIL PROTECTED]:~/shared/kep/Misc/esotools/temp$ ./esoT
> Segmentation fault

New description:

 Compiling and running the attached file produces a segmentation fault. The
 file was originally generated by happy (1.15), but using happy 1.16 does
 not help. Removing the {-# NOINLINE happySpecReduce_1 #-} right before
 main solves the problem.

 {{{
 uname -a:
 Linux femtosec 2.6.18-4-486 #1 Wed May 9 22:23:40 UTC 2007 i686 GNU/Linux

 gcc -v: gcc version 4.1.2

 [EMAIL PROTECTED]:~/shared/kep/Misc/esotools/temp$ ghc -v
 Glasgow Haskell Compiler, Version 6.6.1, for Haskell 98, compiled by GHC
 version 6.6.1
 Using package config file: /home/ctr/tools/lib/ghc-6.6.1/package.conf
 wired-in package base mapped to base-2.1.1
 wired-in package rts mapped to rts-1.0
 wired-in package haskell98 mapped to haskell98-1.0
 wired-in package template-haskell mapped to template-haskell-2.1
 Hsc static flags: -static
 *** Deleting temp files:
 Deleting:
 *** Deleting temp dirs:
 Deleting:
 ghc-6.6.1: no input files
 Usage: For basic information, try the `--help' option.


 === The compilation-run ===
 ghc -O2 -dcore-lint -fvia-C -fglasgow-exts -fwarn-missing-signatures
 --make T -o esoT
 [1 of 1] Compiling Main             ( T.hs, T.o )

 GenericTemplate.hs:174:0:
     Warning: Definition but no type signature for `happyShift'

 GenericTemplate.hs:184:0:
     Warning: Definition but no type signature for `happySpecReduce_0'

 GenericTemplate.hs:189:0:
     Warning: Definition but no type signature for `happySpecReduce_1'

 GenericTemplate.hs:195:0:
     Warning: Definition but no type signature for `happySpecReduce_2'

 GenericTemplate.hs:201:0:
     Warning: Definition but no type signature for `happySpecReduce_3'

 GenericTemplate.hs:207:0:
     Warning: Definition but no type signature for `happyReduce'

 GenericTemplate.hs:215:0:
     Warning: Definition but no type signature for `happyMonadReduce'

 GenericTemplate.hs:222:0:
     Warning: Definition but no type signature for `happyDrop'

 GenericTemplate.hs:225:0:
     Warning: Definition but no type signature for `happyDropStk'

 GenericTemplate.hs:239:0:
     Warning: Definition but no type signature for `happyGoto'

 GenericTemplate.hs:246:0:
     Warning: Definition but no type signature for `happyFail'

 GenericTemplate.hs:258:0:
     Warning: Definition but no type signature for `notHappyAtAll'

 T.hs:92:0:
     Warning: Definition but no type signature for `happyReduction_1'

 T.hs:98:0:
     Warning: Definition but no type signature for `happyReduction_2'

 T.hs:107:0:
     Warning: Definition but no type signature for `happyReduction_3'

 T.hs:115:0:
     Warning: Definition but no type signature for `happyNewToken'

 T.hs:126:0:
     Warning: Definition but no type signature for `happyError_'

 T.hs:129:0:
     Warning: Definition but no type signature for `happyIdentity'

 T.hs:130:0:
     Warning: Definition but no type signature for `happyRunIdentity'

 T.hs:140:0:
     Warning: Definition but no type signature for `happyThen1'

 T.hs:146:0: Warning: Definition but no type signature for `parse'

 T.hs:149:0:
     Warning: Definition but no type signature for `happySeq'

 T.hs:163:0:
     Warning: Definition but no type signature for `happyParse'

 T.hs:171:0:
     Warning: Definition but no type signature for `happyAccept'

 T.hs:120:1:
     Warning: Pattern match(es) are overlapped
              In a case alternative: _ -> ...
 Linking esoT ...

 [EMAIL PROTECTED]:~/shared/kep/Misc/esotools/temp$ ./esoT
 Segmentation fault
 }}}

Comment:

 Thanks for the report!

 It also segfaults with the HEAD. The code is too scary (unsafeCoerce#s)
 for me to be sure it isn't happy at fault, though. It might be useful if
 you could also attach the Happy file that the code is generated from.

-- 
Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/1616>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
_______________________________________________
Glasgow-haskell-bugs mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs

Reply via email to