Opened 9 years ago

Closed 9 years ago

#4397 closed bug (fixed)

RULES for Class ops don't fire in HEAD

Reported by: daniel.is.fischer Owned by:
Priority: normal Milestone:
Component: Compiler Version: 7.1
Keywords: RULES, classes Cc:
Operating System: Unknown/Multiple Architecture: Unknown/Multiple
Type of failure: Runtime performance bug Test Case:
Blocked By: Blocking:
Related Tickets: Differential Rev(s):
Wiki Page:

Description

For the attached programme, compiled with 7.1.20101010, the rule truncate/Double->Int doesn't fire, resulting in

-248407781
1
const 0    took   0.004000s
-248407781
truncate   took   0.940059s
-248407781
double2Int took   0.032002s

i.e. truncate is not rewritten to double2Int, although it is given an explicit type signature (same behaviour without a type signature).

-ddump-rule-firings lists

Rule fired: Class op truncate

among (if I haven't miscounted) 41 Class op xxx rules.

That behaviour keeps the fix for #2271 from working and is a severe regression for #1434 .

IMO it's a show-stopper.

Attachments (1)

rulesTest.hs (1.3 KB) - added by daniel.is.fischer 9 years ago.
example for non-firing RULE for a class method

Download all attachments as: .zip

Change History (5)

Changed 9 years ago by daniel.is.fischer

Attachment: rulesTest.hs added

example for non-firing RULE for a class method

comment:1 Changed 9 years ago by daniel.is.fischer

Same behaviour from ghc-7.0.0.20101013.

comment:2 Changed 9 years ago by simonpj

Ah yes I see. Thanks for identifying this flaw. It's all in Rules.isMoreSpecific, which looks wrong to me. I'll validate a fix.

Simon

comment:3 Changed 9 years ago by simonpj

Fixed by

Fri Oct 15 14:18:14 BST 2010  simonpj@microsoft.com
  * Give user-defined rules precedence over built-in rules
  
  This fixes Trac #4397.  See comments with 'isMoreSpecific'.

Try now.

Simon

comment:4 Changed 9 years ago by daniel.is.fischer

Resolution: fixed
Status: newclosed

Yes, works now. Muchas Gracias.

Note: See TracTickets for help on using tickets.