Ticket #4444 (closed bug: fixed)

Opened 3 years ago

Last modified 3 years ago

SPECIALISE pragma rejected; regression

Reported by: igloo Owned by: simonpj
Priority: highest Milestone: 7.0.1
Component: Compiler Version: 7.0.1 RC1
Keywords: Cc:
Operating System: Unknown/Multiple Architecture: Unknown/Multiple
Type of failure: None/Unknown Difficulty:
Test Case: T4444 Blocked By:
Blocking: Related Tickets:

Description

Compiling this module:

module Q where

{-# SPECIALIZE f :: (Bool -> Bool) -> Int #-}
f :: (a -> Bool) -> Int
f = undefined 

fails with:

$ ghc -c Q.hs

Q.hs:3:1:
    Discarding pragma for non-overloaded function `f'
    In the SPECIALISE pragma
      {-# SPECIALIZE f :: (Bool -> Bool) -> Int #-}

This is causing build failures for Munkres, bitarray and bitmap.

Change History

Changed 3 years ago by simonpj

The warning is correct. What do you want?

Oh, maybe it's an error not a warning, is that the issue?

S

Changed 3 years ago by igloo

Hmm, is this example (from docs/users_guide/glasgow_exts.xml) wrong then?:

{-# LANGUAGE GADTs, MagicHash #-}
module Q where

import GHC.Exts

data Arr e where
  ArrInt :: !Int -> ByteArray# -> Arr Int
  ArrPair :: !Int -> Arr e1 -> Arr e2 -> Arr (e1, e2)

(!:) :: Arr e -> Int -> e
{-# SPECIALISE INLINE (!:) :: Arr Int -> Int -> Int #-}
{-# SPECIALISE INLINE (!:) :: Arr (a, b) -> Int -> (a, b) #-}
(ArrInt _ ba)     !: (I# i) = I# (indexIntArray# ba i)
(ArrPair _ a1 a2) !: i      = (a1 !: i, a2 !: i)
Q.hs:11:1:
    Discarding pragma for non-overloaded function `!:'
    In the SPECIALISE pragma
      {-# SPECIALIZE INLINE (sat-args=2) !: :: Arr Int -> Int -> Int #-}

Q.hs:12:1:
    Discarding pragma for non-overloaded function `!:'
    In the SPECIALISE pragma
      {-# SPECIALIZE INLINE (sat-args=2) !: ::
                                           Arr (a, b) -> Int -> (a, b) #-}

If it doesn't make sense, then personally I'm happy for it to be an error.

Changed 3 years ago by simonpj

  • owner set to simonpj

Changed 3 years ago by simonpj

  • status changed from new to merge

Oh yes! Fixed by

Wed Oct 27 17:29:22 BST 2010  simonpj@microsoft.com
  * Warn (not error) for SPECIALISE pragmas without INLINE
  
  See Note [SPECIALISE pragmas] in TcBinds.  Fixes Trac #444.

Pls merge

Changed 3 years ago by igloo

  • status changed from merge to closed
  • testcase set to T4444
  • resolution set to fixed

Merged.

Note: See TracTickets for help on using tickets.