Open MrSmith33 opened 3 months ago
This bug is due to using @naked
and the resulting IR generation not dealing with that properly. With @naked
we load from passed parameter address instead of the usual loading from the temp storage address (where the passed parameter is stored).
Compare the output of this code with/without @naked
:
//@naked
size_t foo(void* data) {
return cast(size_t) data;
}
I see. Should I expect this to be fixed?
Not sure how much we want/should support with @naked
.
I do consider it a bug. If we don't support this usage / it's buggy, then it's better to emit a compile error for it than to leave it unfixed.
On x86_64: https://godbolt.org/z/dEaaqPh7v
produces:
instead of
Changing
void*
toulong
causes LLVM ERROR:Same happens on arm64: https://godbolt.org/z/7Eb3Pqabd