From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 6773 invoked by alias); 15 May 2014 14:09:29 -0000 Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org Received: (qmail 6717 invoked by uid 48); 15 May 2014 14:09:23 -0000 From: "dominiq at lps dot ens.fr" To: gcc-bugs@gcc.gnu.org Subject: [Bug fortran/61180] surprising -Wsurprising warning Date: Thu, 15 May 2014 14:09:00 -0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: fortran X-Bugzilla-Version: 4.9.0 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: dominiq at lps dot ens.fr X-Bugzilla-Status: NEW X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: bug_status cc Message-ID: In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 7bit X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 X-SW-Source: 2014-05/txt/msg01382.txt.bz2 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61180 Dominique d'Humieres changed: What |Removed |Added ---------------------------------------------------------------------------- Status|WAITING |NEW CC| |jvdelisle at gcc dot gnu.org, | |sgk at troutmask dot apl.washingto | |n.edu --- Comment #3 from Dominique d'Humieres --- (1) I shall RTFM before rather than after answering: -Wsurprising is indeed included in -Wall!(which I find surprising, yet another bad naming). (2) with the following patch --- ../_clean/gcc/fortran/expr.c 2014-05-07 12:46:43.000000000 +0200 +++ gcc/fortran/expr.c 2014-05-15 12:00:21.000000000 +0200 @@ -3157,7 +3157,8 @@ gfc_check_assign (gfc_expr *lvalue, gfc_ /* This is possibly a typo: x = f() instead of x => f(). */ if (gfc_option.warn_surprising - && rvalue->expr_type == EXPR_FUNCTION && gfc_expr_attr (rvalue).pointer) + && rvalue->expr_type == EXPR_FUNCTION && gfc_expr_attr (rvalue).pointer + && gfc_expr_attr (lvalue).pointer) gfc_warning ("POINTER-valued function appears on right-hand side of " "assignment at %L", &rvalue->where); --- ../_clean/gcc/fortran/invoke.texi 2014-05-08 19:46:13.000000000 +0200 +++ gcc/fortran/invoke.texi 2014-05-15 14:38:09.000000000 +0200 @@ -852,21 +852,26 @@ This currently produces a warning under I get (without regression) [Book15] f90/bug% gfc pr61180.f90 -Wall pr61180.f90:27.8: data3=get_data(foo) 1 Warning: POINTER-valued function appears on right-hand side of assignment at (1) I shamelessly admit a very limited understanding of 'gfc_expr_attr (lvalue).(pointer|target))': replacing 'gfc_expr_attr (lvalue).pointer' with 'gfc_expr_attr (lvalue).target' gives the last two warning, while '!gfc_expr_attr (lvalue).pointer' gives the first one only. (3) Is the following change in the manual OK? @itemize @bullet @item -An INTEGER SELECT construct has a CASE that can never be matched as its -lower value is greater than its upper value. +An @code{INTEGER SELECT} construct has a @code{CASE} that can never be +matched as its lower value is greater than its upper value. @item -A LOGICAL SELECT construct has three CASE statements. +A @code{LOGICAL SELECT} construct has three @code{CASE} statements. @item -A TRANSFER specifies a source that is shorter than the destination. +A @code{TRANSFER} specifies a source that is shorter than the destination. @item -The type of a function result is declared more than once with the same type. If -@option{-pedantic} or standard-conforming mode is enabled, this is an error. +The type of a function result is declared more than once with the same +type. If @option{-pedantic} or standard-conforming mode is enabled, +this is an error. @item A @code{CHARACTER} variable is declared with negative length. + +@item +@code{POINTER}-valued function appears on right-hand side of assignment +to a pointer. @end itemize @item -Wtabs Note I have wrapped some additional keyword in @code. Is it OK?