diff options
author | Richard Biener <rguenther@suse.de> | 2019-11-20 07:33:19 +0000 |
---|---|---|
committer | Richard Biener <rguenth@gcc.gnu.org> | 2019-11-20 07:33:19 +0000 |
commit | 3e00ba47b932a13b57061b2d2c95c768ab811d1b (patch) | |
tree | bb2b932e36924ca3737f2da2a580c0a839e4b93a /gcc/c/c-decl.c | |
parent | 54bf2539c55b886ea60d407a7ef2f56f0a19e861 (diff) | |
download | gcc-3e00ba47b932a13b57061b2d2c95c768ab811d1b.zip gcc-3e00ba47b932a13b57061b2d2c95c768ab811d1b.tar.gz gcc-3e00ba47b932a13b57061b2d2c95c768ab811d1b.tar.bz2 |
re PR c/92088 (aggregates with VLAs and nested functions are broken)
2019-11-20 Richard Biener <rguenther@suse.de>
PR c/92088
c/
* c-decl.c (grokdeclarator): Prevent inlining of nested
function with VLA arguments.
* builtins.c (compute_objsize): Deal with VLAs.
* gcc.dg/torture/pr92088-1.c: New testcase.
* gcc.dg/torture/pr92088-2.c: Likewise.
From-SVN: r278477
Diffstat (limited to 'gcc/c/c-decl.c')
-rw-r--r-- | gcc/c/c-decl.c | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/gcc/c/c-decl.c b/gcc/c/c-decl.c index d153de2..caa9c85 100644 --- a/gcc/c/c-decl.c +++ b/gcc/c/c-decl.c @@ -7405,6 +7405,23 @@ grokdeclarator (const struct c_declarator *declarator, "no linkage"); } + /* For nested functions disqualify ones taking VLAs by value + from inlining since the middle-end cannot deal with this. + ??? We should arrange for those to be passed by reference + with emitting the copy on the caller side in the frontend. */ + if (storage_class == csc_none + && TREE_CODE (type) == FUNCTION_TYPE) + for (tree al = TYPE_ARG_TYPES (type); al; al = TREE_CHAIN (al)) + { + tree arg = TREE_VALUE (al); + if (arg != error_mark_node + && C_TYPE_VARIABLE_SIZE (arg)) + { + DECL_UNINLINABLE (decl) = 1; + break; + } + } + /* Record `register' declaration for warnings on & and in case doing stupid register allocation. */ |