diff options
| author | Martin Uecker <uecker@tugraz.at> | 2025-10-05 20:53:43 +0200 |
|---|---|---|
| committer | Martin Uecker <uecker@gcc.gnu.org> | 2025-11-01 08:00:45 +0100 |
| commit | bb63537088d755ad62b64887bd537d1ed84e823d (patch) | |
| tree | becc8ad1f8f44efd5f9644696b7f010b901db17b /gcc/testsuite/gcc.dg/fold-vecperm-1.c | |
| parent | 5175ef7f7577a1ef4151f306161a1dab904f23bb (diff) | |
| download | gcc-master.zip gcc-master.tar.gz gcc-master.tar.bz2 | |
This patch implements a GNU extension by allowing compound literals
to be VLAs which then can be initialized with an empty initializer.
This addresses a use case where one would now need to use alloca, but
this also has limitations (e.g. allocated memory accumulates in a loop).
The error for a compound literal with variable size is changed to a
pedwarn, and a new error for static and constexpr is added.
gcc/c/ChangeLog:
* c-decl.cc (build_compound_literal): Add error.
* c-parser.cc (c_parser_braced_init): Take bool argument for
variable size instead of DECL.
(c_parser_initializer,c_parser_initval): Adapt.
(c_parser_postfix_expression_after_paren_type): Change
error to pedwarn.
* c-typeck.cc (process_init_element): Add error for
variable-size compound literal with static or constexpr.
gcc/ChangeLog:
* doc/extend.texi: Document new extension.
gcc/testsuite/ChangeLog:
* gcc.dg/gnu-compoundlit-1.c: New test.
* gcc.dg/gnu-compoundlit-2.c: New test.
* gcc.dg/pr68090.c: Adapt.
* gcc.dg/vla-init-4.c: Adapt.
* gcc.dg/vla-init-5.c: Adapt.
Diffstat (limited to 'gcc/testsuite/gcc.dg/fold-vecperm-1.c')
0 files changed, 0 insertions, 0 deletions
