public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc(refs/vendors/redhat/heads/gcc-9-branch)] backport: re PR fortran/92781 (ICE in convert_nonlocal_reference_op, at tree-nested.c:1065)
@ 2020-01-23  9:47 Jakub Jelinek
  0 siblings, 0 replies; 2+ messages in thread
From: Jakub Jelinek @ 2020-01-23  9:47 UTC (permalink / raw)
  To: gcc-cvs

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

commit ec2894778c53b4906ded413277c5ef19fe7865ae
Author: Jakub Jelinek <jakub@redhat.com>
Date:   Fri Dec 20 18:36:08 2019 +0100

    backport: re PR fortran/92781 (ICE in convert_nonlocal_reference_op, at tree-nested.c:1065)
    
    	Backported from mainline
    	2019-12-05  Jakub Jelinek  <jakub@redhat.com>
    
    	PR fortran/92781
    	* trans-decl.c (gfc_get_symbol_decl): If sym->backend_decl is
    	current_function_decl, add length to current rather than parent
    	function and expect DECL_CONTEXT (length) to be current_function_decl.
    
    	* gfortran.dg/pr92781.f90: New test.
    
    From-SVN: r279667

Diff:
---
 gcc/fortran/ChangeLog                 |  7 +++++++
 gcc/fortran/trans-decl.c              | 11 +++++++----
 gcc/testsuite/ChangeLog               |  5 +++++
 gcc/testsuite/gfortran.dg/pr92781.f90 | 11 +++++++++++
 4 files changed, 30 insertions(+), 4 deletions(-)

diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog
index 06d2343..2ed0089 100644
--- a/gcc/fortran/ChangeLog
+++ b/gcc/fortran/ChangeLog
@@ -1,6 +1,13 @@
 2019-12-20  Jakub Jelinek  <jakub@redhat.com>
 
 	Backported from mainline
+	2019-12-05  Jakub Jelinek  <jakub@redhat.com>
+
+	PR fortran/92781
+	* trans-decl.c (gfc_get_symbol_decl): If sym->backend_decl is
+	current_function_decl, add length to current rather than parent
+	function and expect DECL_CONTEXT (length) to be current_function_decl.
+
 	2019-11-27  Jakub Jelinek  <jakub@redhat.com>
 
 	PR fortran/91944
diff --git a/gcc/fortran/trans-decl.c b/gcc/fortran/trans-decl.c
index 27613f7..71f751d 100644
--- a/gcc/fortran/trans-decl.c
+++ b/gcc/fortran/trans-decl.c
@@ -1611,15 +1611,18 @@ gfc_get_symbol_decl (gfc_symbol * sym)
 	      /* Add the string length to the same context as the symbol.  */
 	      if (DECL_CONTEXT (length) == NULL_TREE)
 		{
-		  if (DECL_CONTEXT (sym->backend_decl)
-		      == current_function_decl)
+		  if (sym->backend_decl == current_function_decl
+		      || (DECL_CONTEXT (sym->backend_decl)
+			  == current_function_decl))
 		    gfc_add_decl_to_function (length);
 		  else
 		    gfc_add_decl_to_parent_function (length);
 		}
 
-	      gcc_assert (DECL_CONTEXT (sym->backend_decl)
-			  == DECL_CONTEXT (length));
+	      gcc_assert (sym->backend_decl == current_function_decl
+			  ? DECL_CONTEXT (length) == current_function_decl
+			  : (DECL_CONTEXT (sym->backend_decl)
+			     == DECL_CONTEXT (length)));
 
 	      gfc_defer_symbol_init (sym);
 	    }
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index c7b96bb..af36fed 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,6 +1,11 @@
 2019-12-20  Jakub Jelinek  <jakub@redhat.com>
 
 	Backported from mainline
+	2019-12-05  Jakub Jelinek  <jakub@redhat.com>
+
+	PR fortran/92781
+	* gfortran.dg/pr92781.f90: New test.
+
 	2019-12-04  Jakub Jelinek  <jakub@redhat.com>
 
 	PR fortran/92756
diff --git a/gcc/testsuite/gfortran.dg/pr92781.f90 b/gcc/testsuite/gfortran.dg/pr92781.f90
new file mode 100644
index 0000000..67a1961
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/pr92781.f90
@@ -0,0 +1,11 @@
+! PR fortran/92781
+! { dg-do compile }
+
+function foo ()
+  character(:), allocatable :: foo
+  call bar ()
+  foo = 'abc'
+contains
+  subroutine bar
+  end
+end


^ permalink raw reply	[flat|nested] 2+ messages in thread

* [gcc(refs/vendors/redhat/heads/gcc-9-branch)] backport: re PR fortran/92781 (ICE in convert_nonlocal_reference_op, at tree-nested.c:1065)
@ 2020-01-22 20:23 Jakub Jelinek
  0 siblings, 0 replies; 2+ messages in thread
From: Jakub Jelinek @ 2020-01-22 20:23 UTC (permalink / raw)
  To: gcc-cvs

https://gcc.gnu.org/g:6b321171607fedd5f5b991913b765682e9a24bf3

commit 6b321171607fedd5f5b991913b765682e9a24bf3
Author: Jakub Jelinek <jakub@redhat.com>
Date:   Fri Dec 20 18:36:08 2019 +0100

    backport: re PR fortran/92781 (ICE in convert_nonlocal_reference_op, at tree-nested.c:1065)
    
    	Backported from mainline
    	2019-12-05  Jakub Jelinek  <jakub@redhat.com>
    
    	PR fortran/92781
    	* trans-decl.c (gfc_get_symbol_decl): If sym->backend_decl is
    	current_function_decl, add length to current rather than parent
    	function and expect DECL_CONTEXT (length) to be current_function_decl.
    
    	* gfortran.dg/pr92781.f90: New test.

Diff:
---
 gcc/fortran/ChangeLog                 |  7 +++++++
 gcc/fortran/trans-decl.c              | 11 +++++++----
 gcc/testsuite/ChangeLog               |  5 +++++
 gcc/testsuite/gfortran.dg/pr92781.f90 | 11 +++++++++++
 4 files changed, 30 insertions(+), 4 deletions(-)

diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog
index 06d2343..2ed0089 100644
--- a/gcc/fortran/ChangeLog
+++ b/gcc/fortran/ChangeLog
@@ -1,6 +1,13 @@
 2019-12-20  Jakub Jelinek  <jakub@redhat.com>
 
 	Backported from mainline
+	2019-12-05  Jakub Jelinek  <jakub@redhat.com>
+
+	PR fortran/92781
+	* trans-decl.c (gfc_get_symbol_decl): If sym->backend_decl is
+	current_function_decl, add length to current rather than parent
+	function and expect DECL_CONTEXT (length) to be current_function_decl.
+
 	2019-11-27  Jakub Jelinek  <jakub@redhat.com>
 
 	PR fortran/91944
diff --git a/gcc/fortran/trans-decl.c b/gcc/fortran/trans-decl.c
index 27613f7..71f751d 100644
--- a/gcc/fortran/trans-decl.c
+++ b/gcc/fortran/trans-decl.c
@@ -1611,15 +1611,18 @@ gfc_get_symbol_decl (gfc_symbol * sym)
 	      /* Add the string length to the same context as the symbol.  */
 	      if (DECL_CONTEXT (length) == NULL_TREE)
 		{
-		  if (DECL_CONTEXT (sym->backend_decl)
-		      == current_function_decl)
+		  if (sym->backend_decl == current_function_decl
+		      || (DECL_CONTEXT (sym->backend_decl)
+			  == current_function_decl))
 		    gfc_add_decl_to_function (length);
 		  else
 		    gfc_add_decl_to_parent_function (length);
 		}
 
-	      gcc_assert (DECL_CONTEXT (sym->backend_decl)
-			  == DECL_CONTEXT (length));
+	      gcc_assert (sym->backend_decl == current_function_decl
+			  ? DECL_CONTEXT (length) == current_function_decl
+			  : (DECL_CONTEXT (sym->backend_decl)
+			     == DECL_CONTEXT (length)));
 
 	      gfc_defer_symbol_init (sym);
 	    }
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index bc83d22..0594e99 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,6 +1,11 @@
 2019-12-20  Jakub Jelinek  <jakub@redhat.com>
 
 	Backported from mainline
+	2019-12-05  Jakub Jelinek  <jakub@redhat.com>
+
+	PR fortran/92781
+	* gfortran.dg/pr92781.f90: New test.
+
 	2019-12-04  Jakub Jelinek  <jakub@redhat.com>
 
 	PR fortran/92756
diff --git a/gcc/testsuite/gfortran.dg/pr92781.f90 b/gcc/testsuite/gfortran.dg/pr92781.f90
new file mode 100644
index 0000000..67a1961
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/pr92781.f90
@@ -0,0 +1,11 @@
+! PR fortran/92781
+! { dg-do compile }
+
+function foo ()
+  character(:), allocatable :: foo
+  call bar ()
+  foo = 'abc'
+contains
+  subroutine bar
+  end
+end


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2020-01-23  9:47 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-01-23  9:47 [gcc(refs/vendors/redhat/heads/gcc-9-branch)] backport: re PR fortran/92781 (ICE in convert_nonlocal_reference_op, at tree-nested.c:1065) Jakub Jelinek
  -- strict thread matches above, loose matches on Subject: below --
2020-01-22 20:23 Jakub Jelinek

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).