2024-10-15 22:33 AEDT

View Issue Details Jump to Notes ]
IDProjectCategoryView StatusLast Update
0000085mercuryBugpublic2008-09-23 18:45
Reporterjuliensf 
Assigned To 
PrioritynormalSeverityminorReproducibilityalways
StatusnewResolutionopen 
Product Version 
Target VersionFixed in Version 
Summary0000085: stage 1 compiler aborts when compiled with -O5 --intermodule-optimization
Description
Compilation of compiler/deep_profiling.m fails in grade asm_fast.gc with
-O5 --intermodule-optimization using ROTD 2008-09-19 (on taura, although
this is occurring on all machines that use the above optimization settings).

The abort message is:

Uncaught Mercury exception:
Software Error: code_gen.m: Unexpected: nondet model in det/semidet context
Stack dump not available in this grade.
TagsNo tags attached.
Attached Files
  • ? file icon bug85.m (5,854 bytes) 2008-09-23 16:14

-Relationships
+Relationships

-Notes

~0000150

juliensf (administrator)

The abort occurs during the following step:

% Generating low-level (LLDS) code for predicate `ll_backend.deep_profiling.coverage_prof_second_pass_goal'/7 mode 0

I've committed a workaround that forces the affected module to be compiled at -O2.
The bug does not occur at that optimization level.

~0000151

juliensf (administrator)

In fact, this has nothing to do with --intermodule-optimisation. The bug occurs with -O3.

~0000152

juliensf (administrator)

Last edited: 2008-09-23 16:17

I've added a test case for this one that is independent of the compiler.
Compile with: -O0 --deforestation -C

~0000153

zs (developer)

The body of the affected predicate has two switches followed by an if-then-else. Deforestation pushes the second switch and the if-then-else into each arm of the first switch, and then specializes the if-then-else. The problem is that in the process of specialization, it sets the determinism of the condition to nondet, when it should be semidet. The cause could be fact that, after propagating CoverageAfterKnown0 = CoverageAfterKnown1, it replaces the original test in the condition (CoverageAfterKnown1 = coverage_after_known) with a test on CoverageAfterKnown0, and thus updates the nonlocals set. It may think that this affects the determinism of the disjunction that is the condition, but in this case it doesn't.

The problem part of the HLDS dump is the following.

   ( % cannot_fail switch on `MaybeDPCoverageInfo'
      % MaybeDPCoverageInfo has functor maybe.no/0
      % nonlocals: CoverageAfterKnown0, GoalExpr0, CPOptions, IsMDProfInst, CoverageAfterKnown
      % determinism: multi
      ( % conjunction
        % nonlocals: GoalTrivial
        % determinism: det
        GoalTrivial = bug85.goal_is_nontrivial
        ,
        % nonlocals: CoverageAfterKnown0, GoalExpr0, CPOptions, IsMDProfInst, GoalTrivial, CoverageAfterKnown
        % determinism: multi
        (if
          % nonlocals: CoverageAfterKnown0, GoalExpr0, IsMDProfInst, GoalTrivial
          % determinism: nondet
          ( % disjunction
            % nonlocals: IsMDProfInst
            % determinism: semidet
            IsMDProfInst = bug85.goal_is_mdprof_inst
          ;
            % nonlocals: CoverageAfterKnown0
            % determinism: semidet
            CoverageAfterKnown0 = bug85.coverage_after_known
          ;
            % nonlocals: GoalTrivial
            % determinism: semidet
            GoalTrivial = bug85.goal_is_trivial
          ;
            % nonlocals: GoalExpr0
            % determinism: semidet
            ( % conjunction
              % nonlocals: GoalExpr0, V_42
              % determinism: semidet
              GoalExpr0 = bug85.conj(V_42, V_25)
              ,
              % nonlocals: V_42
              % determinism: semidet
              V_42 = bug85.plain_conj
            )
          )
+Notes

-Issue History
Date Modified Username Field Change
2008-09-23 09:44 juliensf New Issue
2008-09-23 11:21 juliensf Note Added: 0000150
2008-09-23 11:29 juliensf Note Added: 0000151
2008-09-23 16:14 juliensf File Added: bug85.m
2008-09-23 16:14 juliensf Note Added: 0000152
2008-09-23 16:17 juliensf Note Edited: 0000152
2008-09-23 18:45 zs Note Added: 0000153
+Issue History