re PR fortran/71764 (ICE in gfc_trans_structure_assign)
authorJerry DeLisle <jvdelisle@gcc.gnu.org>
Fri, 8 Jul 2016 04:36:16 +0000 (04:36 +0000)
committerJerry DeLisle <jvdelisle@gcc.gnu.org>
Fri, 8 Jul 2016 04:36:16 +0000 (04:36 +0000)
2016-07-07  Jerry DeLisle  <jvdelisle@gcc.gnu.org>

PR fortran/71764
* trans-expr.c (gfc_trans_structure_assign): Remove assert.

* gfortran.dg/pr71764.f90: New test.

From-SVN: r238156

gcc/fortran/ChangeLog
gcc/fortran/trans-expr.c
gcc/testsuite/ChangeLog
gcc/testsuite/gfortran.dg/pr71764.f90 [new file with mode: 0644]

index f4d84e85557e9fe2510c343edf26797fe36f6d11..afd9f061baac4f3591cb032539742a86bfd9b217 100644 (file)
@@ -1,3 +1,8 @@
+2016-07-07  Jerry DeLisle  <jvdelisle@gcc.gnu.org>
+
+       PR fortran/71764
+       * trans-expr.c (gfc_trans_structure_assign): Remove assert.
+
 2016-07-07  Martin Liska  <mliska@suse.cz>
 
        * lang.opt (Wundefined-do-loop): New option.
index b5731aa8bbe2a48cc8bfddf21b5cc4a2edaeb1da..4321850b59d1de0c6ef36f0eb912880b12a0c073 100644 (file)
@@ -7358,7 +7358,6 @@ gfc_trans_structure_assign (tree dest, gfc_expr * expr, bool init)
     {
       gfc_se se, lse;
 
-      gcc_assert (cm->backend_decl == NULL);
       gfc_init_se (&se, NULL);
       gfc_init_se (&lse, NULL);
       gfc_conv_expr (&se, gfc_constructor_first (expr->value.constructor)->expr);
index c61e6e5a201afaca7ed1479a5aed1abe22f4b257..22a4a5888030f978b2623ca976f8600e54075324 100644 (file)
@@ -1,3 +1,8 @@
+2016-07-07  Jerry DeLisle  <jvdelisle@gcc.gnu.org>
+
+       PR fortran/71764
+       * gfortran.dg/pr71764.f90: New test.
+
 2016-07-07  Jakub Jelinek  <jakub@redhat.com>
            Kai Tietz  <ktietz70@googlemail.com>
 
diff --git a/gcc/testsuite/gfortran.dg/pr71764.f90 b/gcc/testsuite/gfortran.dg/pr71764.f90
new file mode 100644 (file)
index 0000000..48176f8
--- /dev/null
@@ -0,0 +1,34 @@
+! { dg-do run }
+! PR71764 
+program p
+   use iso_c_binding, only: c_ptr, c_null_ptr, c_ptr, c_associated, c_loc
+   logical, target :: rls
+   real, target :: t = 3.14
+   type(c_ptr) :: nullptr,c
+   real, pointer :: k
+   nullptr = c_null_ptr
+   c = nullptr
+   rls = c_associated(c)
+   if (rls) call abort
+   if (c_associated(c)) call abort
+   c = c_loc(rls)
+   if (.not. c_associated(c)) call abort
+   c = nullptr
+   if (c_associated(c)) call abort
+   c = c_loc(t)
+   k => t
+   call association_test(k, c)
+contains
+  subroutine association_test(a,b)
+    use iso_c_binding, only: c_associated, c_loc, c_ptr
+    implicit none
+    real, pointer :: a
+    type(c_ptr) :: b
+    if(c_associated(b, c_loc(a))) then
+       return
+    else
+       call abort
+    end if
+  end subroutine association_test
+end
+