[PR,57804] Wasted work in gfc_trans_transfer()
diff mbox

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

Commit Message

pchang9@cs.wisc.edu July 23, 2013, 9:55 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=57804

Bootstrap and regression-tested on x86_64-linux.

In method "gfc_trans_transfer()" in gcc/fortran/trans-io.c, the loop
on line 2261 should break immediately after "seen_vector" is set to
"true".


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

        * trans-io.c (gfc_trans_transfer): Exit loop after
        setting seen_vector.




-Chang
Index: gcc/fortran/trans-io.c
===================================================================
--- gcc/fortran/trans-io.c	(revision 201034)
+++ gcc/fortran/trans-io.c	(working copy)
@@ -2260,7 +2260,10 @@
 	    {
 	      for (n = 0; n < ref->u.ar.dimen; n++)
 		if (ref->u.ar.dimen_type[n] == DIMEN_VECTOR)
-		  seen_vector = true;
+		  {
+		    seen_vector = true;
+		    break;
+		  }
 	    }
 
 	  if (seen_vector && last_dt == READ)

Comments

Jeff Law July 29, 2013, 7:10 p.m. UTC | #1
On 07/23/2013 03:55 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=57804
>
> Bootstrap and regression-tested on x86_64-linux.
>
> In method "gfc_trans_transfer()" in gcc/fortran/trans-io.c, the loop
> on line 2261 should break immediately after "seen_vector" is set to
> "true".
>
>
> 2013-07-23  Chang  <pchang9@cs.wisc.edu>
>
>          * trans-io.c (gfc_trans_transfer): Exit loop after
>          setting seen_vector.
Installed.  Thanks!

jeff

Patch
diff mbox

Index: gcc/fortran/trans-io.c
===================================================================
--- gcc/fortran/trans-io.c	(revision 201034)
+++ gcc/fortran/trans-io.c	(working copy)
@@ -2260,7 +2260,10 @@ 
 	    {
 	      for (n = 0; n < ref->u.ar.dimen; n++)
 		if (ref->u.ar.dimen_type[n] == DIMEN_VECTOR)
-		  seen_vector = true;
+		  {
+		    seen_vector = true;
+		    break;
+		  }
 	    }

 	  if (seen_vector && last_dt == READ)