tinycc-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Tinycc-devel] initializer overflow with arrays on implicit size


From: Tyge Løvset
Subject: Re: [Tinycc-devel] initializer overflow with arrays on implicit size
Date: Sun, 20 Feb 2022 16:22:33 +0100

I have reported this before and tried a bit to debug without success. Very annoying. Only useful info I can give is that is does not happen on GCC compiled on windows, but everywhere else. Might suggest uninitialized memory.

lør. 12. feb. 2022, 07:20 skrev Christian Jullien <eligis@orange.fr>:
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:tinycc-devel-bounces+eligis=orange.fr@nongnu.org] On Behalf Of Arthur Williams via Tinycc-devel
Sent: Saturday, February 12, 2022 03:33
To: tinycc-devel@nongnu.org
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
Tinycc-devel@nongnu.org
https://lists.nongnu.org/mailman/listinfo/tinycc-devel


_______________________________________________
Tinycc-devel mailing list
Tinycc-devel@nongnu.org
https://lists.nongnu.org/mailman/listinfo/tinycc-devel

reply via email to

[Prev in Thread] Current Thread [Next in Thread]