-
Notifications
You must be signed in to change notification settings - Fork 42
Description
The following HILTI program has different behavior with optimizations and without:
module Foo {
import hilti;
type Test = struct() {
method int<64> test();
int<64> x;
};
method int<64> Test::test() {
self.x = 5;
return 1;
}
function void x() {
local Test dat = [$x = 1];
hilti::print(dat);
local y = dat.test();
hilti::print(dat);
}
x();
}
etyp:/Users/etyp/src/spicy jj:(r:zzw) $ hiltic -j test.hlt -g
[$x=1]
[$x=5]
etyp:/Users/etyp/src/spicy jj:(r:vtw) $ hiltic -j test.hlt
[$x=1]
[$x=1]
note that this is just because y is never marked as used so it gets rid of the statement. If you just do dat.test(); then it doesn't get removed.
I'm hitting this when finishing #2228, a test is failing because a method gets removed, and it gets removed despite using self (as a method call).
Metadata
Metadata
Assignees
Type
Projects
Status
Done
Status
Done