mirror of
https://github.com/Mercury-Language/mercury.git
synced 2026-04-21 12:23:44 +00:00
compiler/lco.m:
Fix the first bug, which was a compiler abort when lco tried to take
the address of a sub-word-sized argument. Don't allow this.
Don't allow the address to be taken of double-word arguments either,
until I can test whether this works.
Make a switch complete.
compiler/unify_gen.m:
Fix the second bug, which caused a compiler abort if we tried to take
the address of more than one field of a memory cell.
Factor out some common code.
tests/hard_coded/lco_pack_args_2.{m,exp}:
New test case for the first bug.
tests/hard_coded/lco_pack_args_3.{m,exp}:
New test case for the second bug.
tests/hard_coded/Mercury.options:
tests/hard_coded/Mmakefile:
Enable the new test cases.
45 lines
1.0 KiB
Mathematica
45 lines
1.0 KiB
Mathematica
%---------------------------------------------------------------------------%
|
|
% vim: ts=4 sw=4 et ft=mercury
|
|
%---------------------------------------------------------------------------%
|
|
%
|
|
% Testing whether lco detects attempts to apply it to sub-word arguments
|
|
% (which do not have an address, which means that lco should not be
|
|
% applied to them).
|
|
%
|
|
|
|
:- module lco_pack_args_2.
|
|
:- interface.
|
|
|
|
:- import_module io.
|
|
|
|
:- pred main(io::di, io::uo) is det.
|
|
|
|
%---------------------------------------------------------------------------%
|
|
|
|
:- implementation.
|
|
|
|
:- import_module list.
|
|
|
|
:- type thing
|
|
---> thing(enum, enum, thing, enum, enum) % 5 words -> 3 words
|
|
; nil.
|
|
|
|
:- type enum
|
|
---> enum1
|
|
; enum2
|
|
; enum3
|
|
; enum4
|
|
; enum5.
|
|
|
|
:- pred gen(list(enum)::in, enum::out, thing::out) is det.
|
|
|
|
gen([], enum5, nil).
|
|
gen([E | Es], enum4, T) :-
|
|
gen(Es, ETail, Tail),
|
|
T = thing(E, ETail, Tail, E, E).
|
|
|
|
main(!IO) :-
|
|
gen([enum1, enum2, enum3], _, T),
|
|
io.write(T, !IO),
|
|
io.nl(!IO).
|