]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
backport: re PR fortran/71764 (ICE in gfc_trans_structure_assign)
authorJerry DeLisle <jvdelisle@gcc.gnu.org>
Sat, 16 Jul 2016 05:10:10 +0000 (05:10 +0000)
committerJerry DeLisle <jvdelisle@gcc.gnu.org>
Sat, 16 Jul 2016 05:10:10 +0000 (05:10 +0000)
2016-07-15  Jerry DeLisle  <jvdelisle@gcc.gnu.org>

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

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

From-SVN: r238411

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

index a74afa19d3f1cdeb35c2f8c9af00c88dcfc00ef9..c6253a7358763f6e7db5baf30ff0b23e430ef8f0 100644 (file)
@@ -1,3 +1,9 @@
+2016-07-15  Jerry DeLisle  <jvdelisle@gcc.gnu.org>
+
+       Backport from trunk:
+       PR fortran/71764
+       * trans-expr.c (gfc_trans_structure_assign): Remove assert.
+
 2016-07-13  Andre Vehreschild  <vehre@gcc.gnu.org>
 
        Backport from trunk:
index 6f0bf6148b6151af768e80613d3e6deaad82a15c..5e73115829fb58ecc4838af069c3569227d64a59 100644 (file)
@@ -7158,7 +7158,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 9c1ae55b53dface9d13c03cff86699c43448f279..92d9b4bdd051dfaa646f8e5ef643845b78ae2a91 100644 (file)
@@ -1,3 +1,9 @@
+2016-07-15  Jerry DeLisle  <jvdelisle@gcc.gnu.org>
+
+       Backport from trunk:
+       PR fortran/71764
+       * gfortran.dg/pr71764.f90: New test.
+
 2016-07-13  Andre Vehreschild  <vehre@gcc.gnu.org>
 
        Backport from trunk:
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
+