mirror of
https://github.com/Mercury-Language/mercury.git
synced 2026-04-16 18:03:36 +00:00
Estimated hours taken: 2
Branches: main
Fix another problem with lco reported by Michael Day. The problem was that
(a) the hlc backend always passes floats as unboxed entities, but stored in
structures in boxed form, and (b) the lco transformation can change float
arguments from being passed in structures to being passed as arguments.
The problem is that the argument will be a pointer to an UNBOXED float,
even though the structure field whose address supplies the value of the
pointer is supposed to contain a BOXED float.
compiler/lco.m:
Look for this situation, and if it arises, don't apply lco.
tests/hard_coded/lco_mday_bug_{1,2}.{m,exp}:
Two versions of the test case that exhibit this bug. The first version
works with floats, and shows the bug; the second replaces the floats
with strings, and it works even without this fix. This proves that the
problem was one described above.
tests/hard_coded/Mmakefiles:
tests/hard_coded/Mercury.options:
Enable the new test cases, and compile them with lco.
4 lines
43 B
Plaintext
4 lines
43 B
Plaintext
num_float(43.0)
|
|
float 41.0
|
|
num_float(41.0)
|