* [PATCH][C++] Build DECL_EXPRs for anonymous VLAs
@ 2016-04-29 9:01 Richard Biener
2016-04-29 19:38 ` Jason Merrill
0 siblings, 1 reply; 2+ messages in thread
From: Richard Biener @ 2016-04-29 9:01 UTC (permalink / raw)
To: gcc-patches; +Cc: jason
The following makes sure that the gimplifier properly unshares the
type fields in anonymous VLA types by inserting a DECL_EXPR for
it instead of just forcing a TYPE_SIZE evaluation.
This avoids turning those fields in to garbage during gimplification.
Bootstrapped and tested on x86_64-unknown-linux-gnu.
Ok for trunk?
This fixes an ICE with c-c++-common/ubsan/pr59667.c when the gimplfier
is allowed to introduce SSA names.
Richard.
2016-04-29 Richard Biener <rguenther@suse.de>
cp/
* decl.c (grokdeclarator): Properly insert a DECL_EXPR for
anonymous VLAs.
Index: gcc/cp/decl.c
===================================================================
*** gcc/cp/decl.c.orig 2016-04-28 14:11:00.044581227 +0200
--- gcc/cp/decl.c 2016-04-28 14:11:08.116671106 +0200
*************** grokdeclarator (const cp_declarator *dec
*** 10393,10400 ****
&& (decl_context == NORMAL || decl_context == FIELD)
&& at_function_scope_p ()
&& variably_modified_type_p (type, NULL_TREE))
! /* Force evaluation of the SAVE_EXPR. */
! finish_expr_stmt (TYPE_SIZE (type));
if (declarator->kind == cdk_reference)
{
--- 10393,10403 ----
&& (decl_context == NORMAL || decl_context == FIELD)
&& at_function_scope_p ()
&& variably_modified_type_p (type, NULL_TREE))
! {
! TYPE_NAME (type) = build_decl (UNKNOWN_LOCATION, TYPE_DECL,
! NULL_TREE, type);
! add_decl_expr (TYPE_NAME (type));
! }
if (declarator->kind == cdk_reference)
{
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH][C++] Build DECL_EXPRs for anonymous VLAs
2016-04-29 9:01 [PATCH][C++] Build DECL_EXPRs for anonymous VLAs Richard Biener
@ 2016-04-29 19:38 ` Jason Merrill
0 siblings, 0 replies; 2+ messages in thread
From: Jason Merrill @ 2016-04-29 19:38 UTC (permalink / raw)
To: Richard Biener; +Cc: gcc-patches List
OK.
Jason
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2016-04-29 19:38 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-04-29 9:01 [PATCH][C++] Build DECL_EXPRs for anonymous VLAs Richard Biener
2016-04-29 19:38 ` Jason Merrill
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).