Mercury Bugs - mercury
View Issue Details
0000548mercuryBugpublic2022-02-09 18:212022-02-12 10:57
Reporterjuliensf 
Assigned Tozs 
PrioritynormalSeverityminorReproducibilityhave not tried
StatusresolvedResolutionfixed 
PlatformOSOS Version
Product Version 
Target VersionFixed in Version 
Summary0000548: Stage 2 compiler fails in hlc.gc.pregen -O4 bootcheck
DescriptionBookchecking in the grade hlc.gc.pregen with -O4 fails due to an errors in the generated C code like:

transform_hlds.loop_inv.c:373:11: error: duplicate member ‘transform_hlds__loop_inv__gen_aux_proc_goal_3_p_0_env_0__Var_87’
   MR_Word transform_hlds__loop_inv__gen_aux_proc_goal_3_p_0_env_0__Var_87;
  
This occurs both with both --intermod-opt and --no-intermod-opt.
The problem does not occur with other optimisation levels.
Additional InformationMercury: 22.01-beta-2022-02-08
GCC: 4.8.5
OS: CentOS 7
TagsNo tags attached.
Attached Files

Notes
(0001174)
zs   
2022-02-09 20:47   
The error occurs in the code generated for the gen_aux_proc_goal
predicate, and the repeated variables are part of the implementation
of the invariant_goal predicate, which is inlined into the switch arm
for generic_calls, unifies and foreign_procs indirectly through
gen_aux_proc_handle_nonrecursive_call. Some implementation methods
for switches that ml_switch_gen.m can choose from can duplicate
the code we generate for an arm, and that is what seems to have
happened here. I don't yet know why.
(0001175)
zs   
2022-02-10 00:27   
Actually, there are two separate bugs involved here.
One results in the duplication of auxiliary functions,
and one results in the duplication of fields in environment
structures.

I have a simple fix for the first problem, which I will document
and post tomorrow. The second problem is harder.
(0001176)
zs   
2022-02-12 10:57   
Fixes have been committed for both problems.

Issue History
2022-02-09 18:21juliensfNew Issue
2022-02-09 18:29juliensfSummaryStage 2 compiler fails in hlc.gc.pregn -O4 bootcheck => Stage 2 compiler fails in hlc.gc.pregen -O4 bootcheck
2022-02-09 20:47zsNote Added: 0001174
2022-02-10 00:27zsNote Added: 0001175
2022-02-10 00:27zsAssigned To => zs
2022-02-10 00:27zsStatusnew => assigned
2022-02-12 10:57zsStatusassigned => resolved
2022-02-12 10:57zsResolutionopen => fixed
2022-02-12 10:57zsNote Added: 0001176