[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Tinycc-devel] sizeof() on structure with VLA member gives wrong results
From: |
John Scott |
Subject: |
[Tinycc-devel] sizeof() on structure with VLA member gives wrong results |
Date: |
Tue, 01 Feb 2022 18:23:11 +0000 |
Hi,
GCC supports VLAs as structure and union members as an extension, and it
appears that TinyCC supports this as well. However, sizeof() seems to do
the wrong thing:
#include <stdio.h>
int main(void) {
const int k = 16;
printf("%zu\n", sizeof(struct { char b[k]; }));
}.
This prints 16 with GCC and Clang on an x86_64 Debian Bookworm machine,
but 8 under TinyCC, which obviously cannot be a legitimate size for the
structure. I don't know that there has been any particular effort in
TinyCC to support this extension or whether the presence of this
"feature" is merely incidental, but I wonder if this bug would be
feasible to fix?
I for one think this extension has good use cases (especially with
unions) which I shall not elaborate on here, and would like to see
TinyCC continue to support it.
signature.asc
Description: This is a digitally signed message part
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Tinycc-devel] sizeof() on structure with VLA member gives wrong results,
John Scott <=