re PR fortran/53718 ([OOP] gfortran generates asm label twice in the same output...
authorJanus Weil <janus@gcc.gnu.org>
Wed, 31 Oct 2012 21:55:50 +0000 (22:55 +0100)
committerJanus Weil <janus@gcc.gnu.org>
Wed, 31 Oct 2012 21:55:50 +0000 (22:55 +0100)
2012-10-31  Janus Weil  <janus@gcc.gnu.org>

PR fortran/53718
* trans.h (GFC_DECL_PUSH_TOPLEVEL): Removed.
* trans-decl.c (gfc_get_symbol_decl,gfc_generate_function_code): Remove
GFC_DECL_PUSH_TOPLEVEL.
(build_function_decl): Do not push __copy procedure to toplevel.

2012-10-31  Janus Weil  <janus@gcc.gnu.org>

PR fortran/53718
* gfortran.dg/class_54.f90: New.

From-SVN: r193048

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

index b503f3ae4654a124528a95b76dd55f3a57e4a0c2..8e3e728610cc982b09947f025e8e1f86a2172d1e 100644 (file)
@@ -1,3 +1,11 @@
+2012-10-31  Janus Weil  <janus@gcc.gnu.org>
+
+       PR fortran/53718
+       * trans.h (GFC_DECL_PUSH_TOPLEVEL): Removed.
+       * trans-decl.c (gfc_get_symbol_decl,gfc_generate_function_code): Remove
+       GFC_DECL_PUSH_TOPLEVEL.
+       (build_function_decl): Do not push __copy procedure to toplevel.
+
 2012-10-31  Tobias Burnus  <burnus@net-b.de>
 
        PR fortran/55134
index 910b1500fdc98673a6df59029a362fe03e1aab95..77502170c3cd60f3edb8f05a167cf1f3eb41b357 100644 (file)
@@ -1488,10 +1488,7 @@ gfc_get_symbol_decl (gfc_symbol * sym)
 
   if (sym->attr.vtab
       || (sym->name[0] == '_' && strncmp ("__def_init", sym->name, 10) == 0))
-    {
-      TREE_READONLY (decl) = 1;
-      GFC_DECL_PUSH_TOPLEVEL (decl) = 1;
-    }
+    TREE_READONLY (decl) = 1;
 
   return decl;
 }
@@ -1923,8 +1920,7 @@ build_function_decl (gfc_symbol * sym, bool global)
   /* Layout the function declaration and put it in the binding level
      of the current function.  */
 
-  if (global
-      || (sym->name[0] == '_' && strncmp ("__copy", sym->name, 6) == 0))
+  if (global)
     pushdecl_top_level (fndecl);
   else
     pushdecl (fndecl);
@@ -5425,10 +5421,7 @@ gfc_generate_function_code (gfc_namespace * ns)
 
       next = DECL_CHAIN (decl);
       DECL_CHAIN (decl) = NULL_TREE;
-      if (GFC_DECL_PUSH_TOPLEVEL (decl))
-       pushdecl_top_level (decl);
-      else
-       pushdecl (decl);
+      pushdecl (decl);
       decl = next;
     }
   saved_function_decls = NULL_TREE;
index 7e6d58c1bb63a5dea6616f047dc4679eac3f4a78..652893ee60c013815d7c56046d53858dd6fe10e1 100644 (file)
@@ -824,7 +824,6 @@ struct GTY((variable_size)) lang_decl {
 #define GFC_DECL_CRAY_POINTEE(node) DECL_LANG_FLAG_4(node)
 #define GFC_DECL_RESULT(node) DECL_LANG_FLAG_5(node)
 #define GFC_DECL_SUBREF_ARRAY_P(node) DECL_LANG_FLAG_6(node)
-#define GFC_DECL_PUSH_TOPLEVEL(node) DECL_LANG_FLAG_7(node)
 #define GFC_DECL_CLASS(node) DECL_LANG_FLAG_8(node)
 
 /* An array descriptor.  */
index 1dc498d7e05858707dcbc2c8138e843a54257d58..77a4eaaf726892b8be328434ea1e529f1bbb2f64 100644 (file)
@@ -1,3 +1,8 @@
+2012-10-31  Janus Weil  <janus@gcc.gnu.org>
+
+       PR fortran/53718
+       * gfortran.dg/class_54.f90: New.
+
 2012-10-31  Steven Bosscher  <steven@gcc.gnu.org>
            Jakub Jelinek  <jakub@redhat.com>
 
diff --git a/gcc/testsuite/gfortran.dg/class_54.f90 b/gcc/testsuite/gfortran.dg/class_54.f90
new file mode 100644 (file)
index 0000000..39c306c
--- /dev/null
@@ -0,0 +1,22 @@
+! { dg-do compile }
+!
+! PR 53718: [4.7/4.8 regression] [OOP] gfortran generates asm label twice in the same output file
+!
+! Contributed by Adrian Prantl <adrian@llnl.gov>
+
+module m
+  type t
+  end type
+end module
+
+subroutine sub1
+  use m
+  class(t), pointer :: a1
+end subroutine
+
+subroutine sub2
+  use m
+  class(t), pointer :: a2
+end subroutine
+
+! { dg-final { cleanup-modules "m" } }