Closed
Description
zig 0.9
This code just crashes if compiled with zig cc -g
#include <stddef.h>
typedef struct foo
{
int a;
}foo;
#define OFFSETOF(TYPE, ELEMENT) ((size_t)&(((TYPE *)0)->ELEMENT))
int main(int argc, char** argv)
{
int offset = OFFSETOF(foo, a);
(void) offset;
return 0;
}
the crash happens on the OFFSETOF line:
Unhandled exception at 0x00007FF6955A100F in a.exe: 0xC000001D: Illegal Instruction.
The problem manifested in a dll compiled with zig cc in a slightly different way, but the crash is exactly the same so I suppose the root cause of the problem is the same:
I tried to isolate the problem and arrived at the small program that I posted above, hope it helps.
Metadata
Assignees
Labels
No labels