Ticket #4799 (closed bug: fixed)

Opened 2 years ago

Last modified 2 years ago

Imprecise error regarding SPECIALIZE and INLINE/INLINABLE pragmas

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

Description

Consider the following two modules:

module Test1 where

{-# INLINE f1 #-}
f1 :: (Num a) => a -> a
f1 a = a

module Test2 where

import Test1

{-# SPECIALIZE f1 :: Int -> Int #-}

Compiling with ghc --make Test2 gives

    You cannot SPECIALISE `f1'
      because its definition has no INLINE/INLINABLE pragma

But 'f1' clearly has an INLINE pragma. Adding the -O flag solves the problem. I think the error message given when compiling without optimization could be improved, perhaps mentioning that inlining pragmas are ignored when compiling without optimization.

Change History

Changed 2 years ago by simonpj

Good point. How about this?

    You cannot SPECIALISE `f1'
      because its definition has no INLINE/INLINABLE pragma
      (or you compiled its defining module without -O)

Or suggest other wording?

S

Changed 2 years ago by dreixel

That looks fine to me.

Changed 2 years ago by simonpj

  • status changed from new to closed
  • resolution set to fixed

Fixed by

Thu Dec  2 10:27:06 GMT 2010  simonpj@microsoft.com
  * Improve error message (Trac #4799)

    M ./compiler/typecheck/TcBinds.lhs -2 +2
Note: See TracTickets for help on using tickets.