From: Mark Eggleston Date: Wed, 30 Oct 2019 08:37:29 +0000 (+0000) Subject: Suppress warning with -Wno-overwrite-recursive. X-Git-Tag: upstream/12.2.0~20811 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=91c4891af8f7edd32689a9917db5ae81f4ab0c72;p=platform%2Fupstream%2Fgcc.git Suppress warning with -Wno-overwrite-recursive. The use of -fno-automatic with -frecursive results in a warning implying that recursion will not work. If all relevant local variable have the automatic attribute explicitly declared recursion does work and the warning is redundant. From-SVN: r277602 --- diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog index e77a3a4..0e8de4b 100644 --- a/gcc/fortran/ChangeLog +++ b/gcc/fortran/ChangeLog @@ -1,3 +1,11 @@ +2019-10-30 Mark Eggleston + + * invoke.texi: Add -Wno-overwrite-recursive to list of options. Add + description of -Wno-overwrite-recursive. Fix typo in description + of -Winteger-division. + * lang.opt: Add option -Woverwrite-recursive initialised as on. + * option.c (gfc_post_options): Output warning only if it is enabled. + 2019-10-28 Tobias Burnus PR fortran/91863 diff --git a/gcc/fortran/invoke.texi b/gcc/fortran/invoke.texi index fa60eff..1d5cec1 100644 --- a/gcc/fortran/invoke.texi +++ b/gcc/fortran/invoke.texi @@ -149,10 +149,11 @@ and warnings}. -Wc-binding-type -Wcharacter-truncation -Wconversion @gol -Wdo-subscript -Wfunction-elimination -Wimplicit-interface @gol -Wimplicit-procedure -Wintrinsic-shadow -Wuse-without-only @gol --Wintrinsics-std -Wline-truncation -Wno-align-commons -Wno-tabs @gol --Wreal-q-constant -Wsurprising -Wunderflow -Wunused-parameter @gol --Wrealloc-lhs -Wrealloc-lhs-all -Wfrontend-loop-interchange @gol --Wtarget-lifetime -fmax-errors=@var{n} -fsyntax-only -pedantic @gol +-Wintrinsics-std -Wline-truncation -Wno-align-commons @gol +-Wno-overwrite-recursive -Wno-tabs -Wreal-q-constant -Wsurprising @gol +-Wunderflow -Wunused-parameter -Wrealloc-lhs -Wrealloc-lhs-all @gol +-Wfrontend-loop-interchange -Wtarget-lifetime -fmax-errors=@var{n} @gol +-fsyntax-only -pedantic @gol -pedantic-errors @gol } @@ -989,7 +990,7 @@ nor has been declared as @code{EXTERNAL}. @opindex @code{Winteger-division} @cindex warnings, integer division @cindex warnings, division of integers -Warn if a constant integer division truncates it result. +Warn if a constant integer division truncates its result. As an example, 3/5 evaluates to 0. @item -Wintrinsics-std @@ -1002,6 +1003,15 @@ it as @code{EXTERNAL} procedure because of this. @option{-fall-intrinsics} can be used to never trigger this behavior and always link to the intrinsic regardless of the selected standard. +@item -Wno-overwrite-recursive +@opindex @code{Woverwrite-recursive} +@cindex warnings, overwrite recursive +Do not warn when @option{-fno-automatic} is used with @option{-frecursive}. Recursion +will be broken if the relevant local variables do not have the attribute +@code{AUTOMATIC} explicitly declared. This option can be used to suppress the warning +when it is known that recursion is not broken. Useful for build environments that use +@option{-Werror}. + @item -Wreal-q-constant @opindex @code{Wreal-q-constant} @cindex warnings, @code{q} exponent-letter diff --git a/gcc/fortran/lang.opt b/gcc/fortran/lang.opt index 2cfc76d..35b1206 100644 --- a/gcc/fortran/lang.opt +++ b/gcc/fortran/lang.opt @@ -289,6 +289,10 @@ Wopenmp-simd Fortran ; Documented in C +Woverwrite-recursive +Fortran Warning Var(warn_overwrite_recursive) Init(1) +Warn that -fno-automatic may break recursion. + Wpedantic Fortran ; Documented in common.opt diff --git a/gcc/fortran/options.c b/gcc/fortran/options.c index 771c10e..c875ec1 100644 --- a/gcc/fortran/options.c +++ b/gcc/fortran/options.c @@ -409,7 +409,8 @@ gfc_post_options (const char **pfilename) gfc_warning_now (0, "Flag %<-fno-automatic%> overwrites %<-fmax-stack-var-size=%d%>", flag_max_stack_var_size); else if (!flag_automatic && flag_recursive) - gfc_warning_now (0, "Flag %<-fno-automatic%> overwrites %<-frecursive%>"); + gfc_warning_now (OPT_Woverwrite_recursive, "Flag %<-fno-automatic%> " + "overwrites %<-frecursive%>"); else if (!flag_automatic && flag_openmp) gfc_warning_now (0, "Flag %<-fno-automatic%> overwrites %<-frecursive%> implied by " "%<-fopenmp%>"); diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 1c478fe..519952f 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2019-10-30 Mark Eggleston + + * gfortran.dg/no_overwrite_recursive_1.f90: New test. + * gfortran.dg/no_overwrite_recursive_2.f90: New test. + 2019-10-29 Paolo Carlini * g++.dg/other/ptrmem8.C: Test locations too. diff --git a/gcc/testsuite/gfortran.dg/no_overwrite_recursive_1.f90 b/gcc/testsuite/gfortran.dg/no_overwrite_recursive_1.f90 new file mode 100644 index 0000000..f12c4b8 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/no_overwrite_recursive_1.f90 @@ -0,0 +1,11 @@ +! { dg-do compile } +! { dg-options "-fno-automatic -frecursive" } +! +! Test case contributed by Mark Eggleston +! + +program test + ! do nothing +end program + +! { dg-warning "Flag '-fno-automatic' overwrites '-frecursive'" "warning" { target *-*-* } 0 } diff --git a/gcc/testsuite/gfortran.dg/no_overwrite_recursive_2.f90 b/gcc/testsuite/gfortran.dg/no_overwrite_recursive_2.f90 new file mode 100644 index 0000000..0944537 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/no_overwrite_recursive_2.f90 @@ -0,0 +1,10 @@ +! { dg-do compile } +! { dg-options "-fno-automatic -frecursive -Wno-overwrite-recursive" } +! +! Test case contributed by Mark Eggleston +! + +program test + ! do nothing +end program +