]> git.ipfire.org Git - thirdparty/gcc.git/commit
Evaluate type arguments of sizeof that are structs of variable size [PR101838]
authorMartin Uecker <muecker@gwdg.de>
Thu, 12 Aug 2021 18:32:16 +0000 (20:32 +0200)
committerMartin Uecker <muecker@gwdg.de>
Thu, 12 Aug 2021 18:36:42 +0000 (20:36 +0200)
commitd2ba65ab6010f0d507bf5512a0223692e6653b23
tree149c369c841cfd45b3e81ec9e6510b0ab867c6f4
parent34cd97ff94bdb43e8c9de150f1d89527fc42138e
Evaluate type arguments of sizeof that are structs of variable size [PR101838]

Evaluate type arguments of sizeof for all types of variable size
and not just for VLAs. This fixes PR101838 and some issues related
to PR29970 where statement expressions need to be evaluated so that
the size is well defined.

2021-08-12  Martin Uecker  <muecker@gwdg.de>

gcc/c/
PR c/101838
PR c/29970
* c-typeck.c (c_expr_sizeof_type): Evaluate
size expressions for structs of variable size.

gcc/testsuite/
PR c/101838
* gcc.dg/vla-stexp-2.c: New test.
gcc/c/c-typeck.c
gcc/testsuite/gcc.dg/vla-stexp-2.c [new file with mode: 0644]