backport: re PR c++/80984 (ICE with label/variable ambiguity)

Backported from mainline
	2017-06-13  Jakub Jelinek  <jakub@redhat.com>

	PR c++/80984
	* cp-gimplify.c (cp_genericize): Only look for VAR_DECLs in
	BLOCK_VARS (outer) chain.
	(cxx_omp_const_qual_no_mutable): Likewise.

	* g++.dg/opt/nrv18.C: New test.

From-SVN: r249478
This commit is contained in:
Jakub Jelinek 2017-06-22 00:14:23 +02:00 committed by Jakub Jelinek
parent dedf5c8523
commit 6bf3d75c40
4 changed files with 34 additions and 2 deletions

View File

@ -1,3 +1,13 @@
2017-06-21 Jakub Jelinek <jakub@redhat.com>
Backported from mainline
2017-06-13 Jakub Jelinek <jakub@redhat.com>
PR c++/80984
* cp-gimplify.c (cp_genericize): Only look for VAR_DECLs in
BLOCK_VARS (outer) chain.
(cxx_omp_const_qual_no_mutable): Likewise.
2017-06-20 Jason Merrill <jason@redhat.com>
PR c++/80972 - C++17 ICE with attribute packed.

View File

@ -1622,7 +1622,8 @@ cp_genericize (tree fndecl)
if (outer)
for (var = BLOCK_VARS (outer); var; var = DECL_CHAIN (var))
if (DECL_NAME (t) == DECL_NAME (var)
if (VAR_P (var)
&& DECL_NAME (t) == DECL_NAME (var)
&& DECL_HAS_VALUE_EXPR_P (var)
&& DECL_VALUE_EXPR (var) == t)
{
@ -1869,7 +1870,8 @@ cxx_omp_const_qual_no_mutable (tree decl)
if (outer)
for (var = BLOCK_VARS (outer); var; var = DECL_CHAIN (var))
if (DECL_NAME (decl) == DECL_NAME (var)
if (VAR_P (var)
&& DECL_NAME (decl) == DECL_NAME (var)
&& (TYPE_MAIN_VARIANT (type)
== TYPE_MAIN_VARIANT (TREE_TYPE (var))))
{

View File

@ -1,3 +1,11 @@
2017-06-21 Jakub Jelinek <jakub@redhat.com>
Backported from mainline
2017-06-13 Jakub Jelinek <jakub@redhat.com>
PR c++/80984
* g++.dg/opt/nrv18.C: New test.
2017-06-19 James Greenhalgh <james.greenhalgh@arm.com>
Backport from mainline

View File

@ -0,0 +1,12 @@
// PR c++/80984
// { dg-do compile }
struct A { ~A (); };
A
foo ()
{
A a;
a:
return a;
}