re PR fortran/54224 (Warn for unused internal procedures)
authorJanus Weil <janus@gcc.gnu.org>
Fri, 19 Oct 2012 17:14:46 +0000 (19:14 +0200)
committerJanus Weil <janus@gcc.gnu.org>
Fri, 19 Oct 2012 17:14:46 +0000 (19:14 +0200)
2012-10-19  Janus Weil  <janus@gcc.gnu.org>

PR fortran/54224
* trans-expr.c (conv_function_val): Set TREE_USED.

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

PR fortran/54224
* gfortran.dg/warn_unused_function.f90: New.

From-SVN: r192620

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

index 37afedeaebacc2a10d47fb27669fb69f809fdce0..04304b1220fe453db5dc299cee52d540f2f57127 100644 (file)
@@ -1,3 +1,8 @@
+2012-10-19  Janus Weil  <janus@gcc.gnu.org>
+
+       PR fortran/54224
+       * trans-expr.c (conv_function_val): Set TREE_USED.
+
 2012-10-18  Tobias Burnus  <burnus@net-b.de>
 
        PR fortran/54884
index cf9f34672a4e860749720524b2883c1a6cd82fcd..b4f9f260326ee7b74531804ef627c90567fe34c1 100644 (file)
@@ -2674,6 +2674,8 @@ conv_function_val (gfc_se * se, gfc_symbol * sym, gfc_expr * expr)
       if (!sym->backend_decl)
        sym->backend_decl = gfc_get_extern_function_decl (sym);
 
+      TREE_USED (sym->backend_decl) = 1;
+
       tmp = sym->backend_decl;
 
       if (sym->attr.cray_pointee)
index be805f2f0331d7f32e4554f83e3f36bf0862eecb..adb5542de5b4664e08c03be792da239fa10bab1b 100644 (file)
@@ -1,3 +1,8 @@
+2012-10-19  Janus Weil  <janus@gcc.gnu.org>
+
+       PR fortran/54224
+       * gfortran.dg/warn_unused_function.f90: New.
+
 2012-10-19  Greta Yorsh  <Greta.Yorsh@arm.com>
 
        * lib/target-supports.exp (check_effective_target_arm_prefer_ldrd_strd):
diff --git a/gcc/testsuite/gfortran.dg/warn_unused_function.f90 b/gcc/testsuite/gfortran.dg/warn_unused_function.f90
new file mode 100644 (file)
index 0000000..4d0ed9a
--- /dev/null
@@ -0,0 +1,21 @@
+! { dg-do compile }
+! { dg-options "-Wunused-function" }
+!
+! PR 54224: [4.8 Regression] Bogus -Wunused-function warning with static function
+!
+! Contributed by Tobias Burnus <burnus@gcc.gnu.org>
+
+module mod_say_hello
+    private :: hello_integer
+contains
+    subroutine say_hello()
+        call hello_integer(123)
+    end subroutine
+
+    subroutine hello_integer( a )
+        integer, intent(in) ::  a
+        print *, "Hello ", a, "!"
+    end subroutine
+end module
+
+! { dg-final { cleanup-modules "mod_say_hello" } }