diff mbox

[PR,57791] Waste work in gfc_check_pointer_assign()

Message ID 572c52f3beb83506456fb925b2478aee.squirrel@webmail.cs.wisc.edu
State New
Headers show

Commit Message

pchang9@cs.wisc.edu July 23, 2013, 9:42 p.m. UTC
Hi,

The problem appears in revision 201034 in version 4.9. I attached a
one-line patch that fixes it.  I also reported this problem
at http://gcc.gnu.org/bugzilla/show_bug.cgi?id=57791

Bootstrap and regression-tested on x86_64-linux.

In method "gfc_check_pointer_assign()" in expr.c, the loop on line
3763 should break immediately after "warn" is set to "true".

2013-07-23  Chang  <pchang9@cs.wisc.edu>

        * expr.c (gfc_check_pointer_assign): Exit loop after setting warn.




-Chang
Index: gcc/fortran/expr.c
===================================================================
--- gcc/fortran/expr.c	(revision 201034)
+++ gcc/fortran/expr.c	(working copy)
@@ -3764,7 +3764,10 @@
 	    ns && ns->proc_name && ns->proc_name->attr.flavor != FL_PROCEDURE;
 	    ns = ns->parent)
 	if (ns->parent == lvalue->symtree->n.sym->ns)
-	  warn = true;
+	  {
+	    warn = true;
+	    break;
+	  }
 
       if (warn)
 	gfc_warning ("Pointer at %L in pointer assignment might outlive the "

Comments

Jeff Law July 29, 2013, 7:09 p.m. UTC | #1
On 07/23/2013 03:42 PM, pchang9@cs.wisc.edu wrote:
> Hi,
>
> The problem appears in revision 201034 in version 4.9. I attached a
> one-line patch that fixes it.  I also reported this problem
> at http://gcc.gnu.org/bugzilla/show_bug.cgi?id=57791
>
> Bootstrap and regression-tested on x86_64-linux.
>
> In method "gfc_check_pointer_assign()" in expr.c, the loop on line
> 3763 should break immediately after "warn" is set to "true".
>
> 2013-07-23  Chang  <pchang9@cs.wisc.edu>
>
>          * expr.c (gfc_check_pointer_assign): Exit loop after setting warn.
Installed.  Thanks!

jeff
diff mbox

Patch

Index: gcc/fortran/expr.c
===================================================================
--- gcc/fortran/expr.c	(revision 201034)
+++ gcc/fortran/expr.c	(working copy)
@@ -3764,7 +3764,10 @@ 
 	    ns && ns->proc_name && ns->proc_name->attr.flavor != FL_PROCEDURE;
 	    ns = ns->parent)
 	if (ns->parent == lvalue->symtree->n.sym->ns)
-	  warn = true;
+	  {
+	    warn = true;
+	    break;
+	  }

       if (warn)
 	gfc_warning ("Pointer at %L in pointer assignment might outlive the "