]> git.ipfire.org Git - thirdparty/gcc.git/commit
c: minor fixes related to arrays of unspecified size
authorMartin Uecker <uecker@tugraz.at>
Fri, 1 Nov 2024 09:15:44 +0000 (10:15 +0100)
committerMartin Uecker <uecker@gcc.gnu.org>
Sat, 9 Nov 2024 10:28:27 +0000 (11:28 +0100)
commit114abf075c1e28358173756042049c9992ae6572
treeb3cba26f42a35465580ee6341838c41d78075eed
parent9c8f3d5e7d5ee64ffe5c50a72b087227f2e8f957
c: minor fixes related to arrays of unspecified size

The patch for PR117145 and PR117245 also fixed PR100420 and PR116284 which
are bugs related to arrays of unspecified size.  Those are now represented
as variable size arrays with size (0, 0).  There are still some loose ends,
which are resolved here by

1. adding a testcase for PR116284,
2. moving code related to creation and detection of arrays of unspecified
sizes in their own functions,
3. preferring a specified size over an unspecified size when forming
a composite type as required by C99 (PR118391)
4. removing useless code in comptypes_internal and composite_type_internal.

PR c/116284
PR c/117391

gcc/c/ChangeLog:
* c-tree.h (c_type_unspecified_p): New inline function.
* c-typeck.cc (c_build_array_type_unspecified): New function.
(comptypes_interal): Remove useless code.
(composite_type_internal): Update.
* c-decl.cc (grokdeclarator): Revise.

gcc/testsuite/ChangeLog:
* gcc.dg/pr116284.c: New test.
* gcc.dg/pr117391.c: New test.
gcc/c/c-decl.cc
gcc/c/c-tree.h
gcc/c/c-typeck.cc
gcc/testsuite/gcc.dg/pr116284.c [new file with mode: 0644]
gcc/testsuite/gcc.dg/pr117391.c [new file with mode: 0644]