From: Janus Weil Date: Fri, 19 Oct 2012 17:14:46 +0000 (+0200) Subject: re PR fortran/54224 (Warn for unused internal procedures) X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=704fc8502fc5ac926349d11d4b6622493e4492fb;p=gcc.git re PR fortran/54224 (Warn for unused internal procedures) 2012-10-19 Janus Weil PR fortran/54224 * trans-expr.c (conv_function_val): Set TREE_USED. 2012-10-19 Janus Weil PR fortran/54224 * gfortran.dg/warn_unused_function.f90: New. From-SVN: r192620 --- diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog index 37afedeaeba..04304b1220f 100644 --- a/gcc/fortran/ChangeLog +++ b/gcc/fortran/ChangeLog @@ -1,3 +1,8 @@ +2012-10-19 Janus Weil + + PR fortran/54224 + * trans-expr.c (conv_function_val): Set TREE_USED. + 2012-10-18 Tobias Burnus PR fortran/54884 diff --git a/gcc/fortran/trans-expr.c b/gcc/fortran/trans-expr.c index cf9f34672a4..b4f9f260326 100644 --- a/gcc/fortran/trans-expr.c +++ b/gcc/fortran/trans-expr.c @@ -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) diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index be805f2f033..adb5542de5b 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2012-10-19 Janus Weil + + PR fortran/54224 + * gfortran.dg/warn_unused_function.f90: New. + 2012-10-19 Greta Yorsh * 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 index 00000000000..4d0ed9abc92 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/warn_unused_function.f90 @@ -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 + +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" } }