Important precision, I reproduce this issue with mob including on RPi arm32;
$ tcc foo.c
foo.c:8: error: internal compiler error
tccgen.c:7728: in init_assert(): initializer overflow


-----Original Message-----
From: Tinycc-devel [mailto:[email protected]] On 
Behalf Of Arthur Williams via Tinycc-devel
Sent: Saturday, February 12, 2022 03:33
To: [email protected]
Cc: Arthur Williams
Subject: [Tinycc-devel] initializer overflow with arrays on implicit size

Greetings,

Found a strange error when trying to build a program with tcc.
The error is
```
test.c:8: error: internal compiler error
tccgen.c:7728: in init_assert(): initializer overflow
```
And here is a minimal example of how to repro it.

```
#include <stdio.h>
struct A {
    char a;
    char b;
};

int main() {
    struct A a[] = { (struct A){1}, (struct A){2}, };
    printf("%d %d\n", a[0].a, a[0].b);
    printf("%d %d\n", a[1].a, a[1].b);
    return 0;
}
```
(printing isn't need to repro the problem)

Took a glance at the code that was generating the error message:
`init_assert`. The commit message for that function seems to imply that
is was temporary and removing this function avoid the error and allows
the code to compile. Tests pass and the output is also as expected.
Is there a reason to keep this function around?

Playing around with the function removed and while the code compiles
find, running with `tcc -run` segfaults. So I imagine the real fix is a
bit less trivial that what I had thought.


Arthur

_______________________________________________
Tinycc-devel mailing list
[email protected]
https://lists.nongnu.org/mailman/listinfo/tinycc-devel


_______________________________________________
Tinycc-devel mailing list
[email protected]
https://lists.nongnu.org/mailman/listinfo/tinycc-devel

Reply via email to