public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc r11-3274] c++: Layout decls with newly-complete type.
@ 2020-09-18  3:20 Jason Merrill
  0 siblings, 0 replies; only message in thread
From: Jason Merrill @ 2020-09-18  3:20 UTC (permalink / raw)
  To: gcc-cvs

https://gcc.gnu.org/g:f627125855075f7ffde74e48481ee961f0bc4c7b

commit r11-3274-gf627125855075f7ffde74e48481ee961f0bc4c7b
Author: Jason Merrill <jason@redhat.com>
Date:   Fri Sep 4 12:14:19 2020 -0400

    c++: Layout decls with newly-complete type.
    
    Martin's -Wplacement-new patch ran into a problem with DECL_SIZE not being
    set on an extern variable for which the type was not complete until after
    its declaration.  complete_vars was deliberately not calling layout_decl for
    some reason, instead leaving that for expand_expr_real_1 much later in the
    compilation.  But if we layout decls at declaration time, I don't see any
    reason we shouldn't lay them out here, when their type is newly complete.
    
    gcc/cp/ChangeLog:
    
            * decl.c (complete_vars): Call layout_var_decl.

Diff:
---
 gcc/cp/decl.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/gcc/cp/decl.c b/gcc/cp/decl.c
index ad2a30fcf71..746ed101fef 100644
--- a/gcc/cp/decl.c
+++ b/gcc/cp/decl.c
@@ -17460,10 +17460,10 @@ complete_vars (tree type)
 	      && (TYPE_MAIN_VARIANT (strip_array_types (type))
 		  == iv->incomplete_type))
 	    {
-	      /* Complete the type of the variable.  The VAR_DECL itself
-		 will be laid out in expand_expr.  */
+	      /* Complete the type of the variable.  */
 	      complete_type (type);
 	      cp_apply_type_quals_to_decl (cp_type_quals (type), var);
+	      layout_var_decl (var);
 	    }
 
 	  /* Remove this entry from the list.  */


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2020-09-18  3:20 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-09-18  3:20 [gcc r11-3274] c++: Layout decls with newly-complete type 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).