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

2021-02-15 Thread Elijah Stone
On Tue, 16 Feb 2021, Michael Matz wrote: (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.) Flexible array members are standard as

Re: [Tinycc-devel] [PATCH 0/4] stdatomic: code generators

2021-02-15 Thread Michael Matz
Hello, On Sun, 14 Feb 2021, Dmitry Selyutin wrote: The first patch introduces a set of routines which any platform which wants to support atomics must implement. I don't quite like that there's a lot of code duplication, but I haven't come up with a good idea on how to avoid it (I've been

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

2021-02-15 Thread Michael Matz
Hello, 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. ($GCC_DIR/gcc/testsuite/gcc.c-torture/compile/pr28865.c) The reduced testcase is: struct A { int a; char b[]; }; struct A a = { 1, "1" }; struct B

Re: [Tinycc-devel] [PATCH 0/4] stdatomic: code generators

2021-02-15 Thread Michael Matz
Hello again, On Tue, 16 Feb 2021, Michael Matz wrote: On Sun, 14 Feb 2021, Dmitry Selyutin wrote: The first patch introduces a set of routines which any platform which wants to support atomics must implement. I don't quite like that there's a lot of code duplication, but I haven't come up

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

2021-02-15 Thread Michael Matz
Hello, On Mon, 15 Feb 2021, Elijah Stone wrote: On Tue, 16 Feb 2021, Michael Matz wrote: (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

[Tinycc-devel] core dump with flex arrays

2021-02-15 Thread Herman ten Brugge via Tinycc-devel
I ran the tests/gcctestsuite.sh script and found one test that dumps core. ($GCC_DIR/gcc/testsuite/gcc.c-torture/compile/pr28865.c) 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

Re: [Tinycc-devel] [PATCH 0/4] stdatomic: code generators

2021-02-15 Thread Elijah Stone
On Mon, 15 Feb 2021, grischka wrote: Why not just provide functions as a library and wrap them into macros from stdatomic.h? No or almost no changes to tcc's generator would be needed. I've posted already a WIP version of atomics-as-support library for amd64. Attached it again. (It needs

Re: [Tinycc-devel] [PATCH 0/4] stdatomic: code generators

2021-02-15 Thread Dmitry Selyutin
> > I've posted already a WIP version of atomics-as-support library for amd64. > Attached it again. > This can be implemented for all architectures without writing assembly by hand for each platform. I actually had such script by the time I started implementing std atomics; this is basically bunch

Re: [Tinycc-devel] [PATCH 0/4] stdatomic: code generators

2021-02-15 Thread Dmitry Selyutin
At least one architecture I know has different models to implement atomics (LSE instructions from AArch64); with gcc, the corresponding switch is -mno-outline-atomics. Once this option is present, compiler inlines atomics, otherwise a function call is emitted.