Even after #593 we seem to be hitting issues in the calling convention. This issue is to track status so I don't forget what's going on.
Reproducer 1
local c = terralib.includec("stdio.h")
struct S2 {
a : int;
b : double;
c : double;
}
terra f10(a : S2)
c.printf("terra: %d %f %f\n", a.a, a.b, a.c)
return a.a, a.b, a.c
end
terra c10(a : int, b : double, c : double)
return f10(S2 { a, b, c })
end
local x = f10({1,2.5,3.5})
print(x, x._0, x._1, x._2)
local y = c10(1, 2.5, 3.5)
print(y, y._0, y._1, y._2)
assert(x._0 == 1)
assert(x._1 == 2.5)
assert(x._2 == 3.5)
Even after #593 we seem to be hitting issues in the calling convention. This issue is to track status so I don't forget what's going on.
Reproducer 1
Produces:
Observations:
Reproducer 2
Produces:
Observations:
f10
into C results in a crash. Note: the shared library is used to disable inlining.Reproducer 3
Produces:
Observations:
terralib.includecstring
permits inlining, which seems to allow this test to pass.Reproducer 4
Produces:
Observation:
__attribute__ ((noinline))
, bringing the crash back.Recommendations
__attribute__ ((noinline))
tocconv_more.t
C generated code to ensure we don't miss any similar bugs in the future.