[Top][All Lists]

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

Re: [Tinycc-devel] core dump with flex arrays

From: Michael Matz
Subject: Re: [Tinycc-devel] core dump with flex arrays
Date: Tue, 16 Feb 2021 00:05:25 +0100 (CET)
User-agent: Alpine 2.21 (LSU 202 2017-01-01)


On Mon, 15 Feb 2021, Herman ten Brugge via Tinycc-devel wrote:

I ran the tests/gcctestsuite.sh script and found one test that dumps core.

The reduced testcase is:

struct A { int a; char b[]; };
struct A a = { 1, "1" };
struct B { struct A a; };
struct B b = { { 1, "1" } };

line 2 works and line 4 dumps core.

I am not sure how to fix this.

Fixed in mob. The cause is the discrepancy in handling string vs. normal array initializers. The former wasn't checking for the problematic situation.

(Note that TCC and GCC behave different with non-top-level flex array members: GCC accepts but discards initializers of these with a warning, TCC rejects them. That's fine, flex array members are an extension.)


reply via email to

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