]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
re PR fortran/50408 (ICE in transfer_expr)
authorTobias Burnus <burnus@net-b.de>
Fri, 25 Nov 2011 17:18:05 +0000 (18:18 +0100)
committerTobias Burnus <burnus@gcc.gnu.org>
Fri, 25 Nov 2011 17:18:05 +0000 (18:18 +0100)
2011-11-25  Tobias Burnus  <burnus@net-b.de>

        PR fortran/50408
        * trans-decl.c (gfc_get_module_backend_decl): Also copy
        ts.u.derived from the gsym if the ts.type is BT_CLASS.
        (gfc_get_extern_function_decl): Copy also the backend_decl
        for the symbol's ts.u.{derived,cl} from the gsym.
        * trans-types.c (gfc_copy_dt_decls_ifequal): Directly
        return if "from" and "to" are the same.

2011-11-25  Tobias Burnus  <burnus@net-b.de>

        PR fortran/50408
        * gfortran.dg/whole_file_35.f90: New.

From-SVN: r181726

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

index 84c5d7ed4928c6ff2b036c6dffe72ea04938eb30..17fa939e2f50e996a9bd70701d281f921b1c91e7 100644 (file)
@@ -1,3 +1,13 @@
+2011-11-25  Tobias Burnus  <burnus@net-b.de>
+
+       PR fortran/50408
+       * trans-decl.c (gfc_get_module_backend_decl): Also copy
+       ts.u.derived from the gsym if the ts.type is BT_CLASS.
+       (gfc_get_extern_function_decl): Copy also the backend_decl
+       for the symbol's ts.u.{derived,cl} from the gsym.
+       * trans-types.c (gfc_copy_dt_decls_ifequal): Directly
+       return if "from" and "to" are the same.
+
 2011-11-24  Tobias Burnus  <burnus@net-b.de>
 
        PR fortran/51218
index 2d987f0b1dc108d4c88811aae1c7151fd438704f..25703f0c52ba1fb6f0c878dbddd9608072efc33a 100644 (file)
@@ -677,7 +677,7 @@ gfc_get_module_backend_decl (gfc_symbol *sym)
        }
       else if (s->backend_decl)
        {
-         if (sym->ts.type == BT_DERIVED)
+         if (sym->ts.type == BT_DERIVED || sym->ts.type == BT_CLASS)
            gfc_copy_dt_decls_ifequal (s->ts.u.derived, sym->ts.u.derived,
                                       true);
          else if (sym->ts.type == BT_CHARACTER)
@@ -1602,6 +1602,11 @@ gfc_get_extern_function_decl (gfc_symbol * sym)
       gfc_find_symbol (sym->name, gsym->ns, 0, &s);
       if (s && s->backend_decl)
        {
+         if (sym->ts.type == BT_DERIVED || sym->ts.type == BT_CLASS)
+           gfc_copy_dt_decls_ifequal (s->ts.u.derived, sym->ts.u.derived,
+                                      true);
+         else if (sym->ts.type == BT_CHARACTER)
+           sym->ts.u.cl->backend_decl = s->ts.u.cl->backend_decl;
          sym->backend_decl = s->backend_decl;
          return sym->backend_decl;
        }
index 24840bff7fa81914bb8f4501dff895871b88e45d..ca078963234ef06da41af6f2101714e68b456856 100644 (file)
@@ -2092,6 +2092,9 @@ gfc_copy_dt_decls_ifequal (gfc_symbol *from, gfc_symbol *to,
   gfc_component *to_cm;
   gfc_component *from_cm;
 
+  if (from == to)
+    return 1;
+
   if (from->backend_decl == NULL
        || !gfc_compare_derived_types (from, to))
     return 0;
index 28fb3a7e5fbf9b2c6e1583a5247454cfd98af5b6..c3edf9be696c3276b447aeb44203aed78810702d 100644 (file)
@@ -1,3 +1,8 @@
+2011-11-25  Tobias Burnus  <burnus@net-b.de>
+
+       PR fortran/50408
+       * gfortran.dg/whole_file_35.f90: New.
+
 2011-11-24  Tobias Burnus  <burnus@net-b.de>
 
        PR fortran/51218
diff --git a/gcc/testsuite/gfortran.dg/whole_file_35.f90 b/gcc/testsuite/gfortran.dg/whole_file_35.f90
new file mode 100644 (file)
index 0000000..46a8865
--- /dev/null
@@ -0,0 +1,28 @@
+! { dg-do compile }
+!
+! PR fortran/50408
+!
+! Contributed by Vittorio Zecca
+!
+       module m
+         type int
+           integer  :: val
+         end type int
+         interface ichar
+           module procedure uch
+        end interface
+       contains
+         function uch (c)
+           character (len=1), intent (in) :: c
+           type (int)                     :: uch
+           intrinsic ichar
+           uch%val = 127 - ichar (c)
+         end function uch 
+       end module m
+
+      program p
+        use m
+        print *,ichar('~') ! must print "1"
+      end program p
+
+! { dg-final { cleanup-modules "m" } }