Mercury Bugs - mercury
View Issue Details
0000221mercuryBugpublic2011-10-11 10:092011-10-24 16:19
Reportermaclarty 
Assigned Tomaclarty 
PrioritynormalSeveritymajorReproducibilityalways
StatusresolvedResolutionfixed 
PlatformOSOS Version
Product Version 
Target VersionFixed in Version 
Summary0000221: ho specialization bug
DescriptionThe attached program produces the wrong output when compiled with --optimize-higher-order. It should output "ho2", but instead outputs "ho1". In do_stuff it is specializing P to ho1, when it shouldn't. Here is the relevant bit of the hlds dump for stage 135:

:- mode do_stuff((builtin.in), (builtin.di), (builtin.uo)) is det.
bug.do_stuff(Maybe, STATE_VARIABLE_IO_0, STATE_VARIABLE_IO) :-
  ( % cannot_fail switch on `Maybe'
    % Maybe has functor maybe.no/0
    P = bug.ho1
  ;
    % Maybe has functor maybe.yes/1
    P = bug.get_ho2
  ),
  bug.ho1(STATE_VARIABLE_IO_0, STATE_VARIABLE_IO).
TagsNo tags attached.
Attached Files? bug.m (674) 2011-10-11 10:09
https://bugs.mercurylang.org/file_download.php?file_id=132&type=bug

There are no notes attached to this issue.

Issue History
2011-10-11 10:09maclartyNew Issue
2011-10-11 10:09maclartyFile Added: bug.m
2011-10-24 16:19maclartyStatusnew => assigned
2011-10-24 16:19maclartyAssigned To => maclarty
2011-10-24 16:19maclartyStatusassigned => resolved
2011-10-24 16:19maclartyResolutionopen => fixed