mirror of
https://github.com/Mercury-Language/mercury.git
synced 2026-04-18 10:53:40 +00:00
Estimated hours taken: 6 (mostly in tracking down the problem)
Branches: main
Work around Mantis bug 160. The bug arises because gcc mishandles this
code sequence:
r1 = mkword(tag, base);
r2 = tag(r1);
In this case, we know r2 == tag, but gcc screws up the optimization.
compiler/peephole.m:
Add a peephole optimization pattern that replaces the second assignment
above with r2 = tag. This should help avoid tickling the gcc bug.
compiler/options.m:
Add a developer-only option, --no-optimize-peep-mkword, that disables
the new pattern. The intention is that we can use this to check whether
gcc has fixed the bug.
compiler/optimize.m:
Get the value of the new option to peephole.m.
compiler/tag_switch.m:
Fix some misleading comments that mmc generated for the bug test case
file.
tests/hard_coded/bug160.{m,exp}:
The test case for this bug.
tests/hard_coded/Mmakefile:
tests/hard_coded/Mercury.options:
Enable the test case.
2 lines
11 B
Plaintext
2 lines
11 B
Plaintext
RESULT: OK
|