This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[C++ PATCH] for PR72457


On 2016.07.23 at 22:55 -0400, Jason Merrill wrote:
> Using build_value_init in a base initialization is wrong, because it
> calls the complete object constructor and misses protected access.  So
> let's handle list-value-initialization in expand_aggr_init_1.
> 
> Tested x86_64-pc-linux-gnu, applying to trunk.

This patch causes https://gcc.gnu.org/bugzilla/show_bug.cgi?id=72457.
And because it was backported, the gcc-6 branch is also affected.

The following fix was tested on ppc64le. OK for trunk and gcc-6?

(Unfortunately the reduced testcase is much too big.)

	 PR c++/72457
	 *constexpr.c (cx_check_missing_mem_inits): Handle potential
	 NULL_TREE.

diff --git a/gcc/cp/constexpr.c b/gcc/cp/constexpr.c
index 6bcb41ae8254..83fd9a4896ac 100644
--- a/gcc/cp/constexpr.c
+++ b/gcc/cp/constexpr.c
@@ -734,7 +734,7 @@ cx_check_missing_mem_inits (tree fun, tree body, bool complain)
 	      || DECL_ARTIFICIAL (index))
 	    continue;
 	}
-      for (; field != index; field = DECL_CHAIN (field))
+      for (; field != NULL_TREE && field != index; field = DECL_CHAIN (field))
 	{
 	  tree ftype;
 	  if (TREE_CODE (field) != FIELD_DECL

-- 
Markus


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]