Assertion error in 'process_aggregate_arg' for anonymous struct/union
andy-hanson opened this issue · 2 comments
andy-hanson commented
#include <stdio.h>
struct S {
int filler;
struct {
const char* str;
};
};
void f(struct S a) {
printf("%s\n", a.str);
}
void main(void) {
f((struct S) {.str = "foo"});
}
Running c2m a.c -eg
: This should print "foo". Instead there is an internal assertion error:
c2m: c2mir/x86_64/cx86_64-ABI-code.c:314: process_aggregate_arg: Assertion `FALSE' failed.
Tested using a local build of commit 9b7aa03 with make debug
then sudo make install
.
The error seems to happen if there is any anonymous struct or union that contains a pointer member. There's no error if I break it out to a named type, remove int filler;
, or use char str[4]
instead.
vnmakarov commented
andy-hanson commented
Thanks, I confirmed it's working now.