diff mbox

[PR,57802] Wasted work in set_loop_bounds()

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

Commit Message

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

Bootstrap and regression-tested on x86_64-linux.

In method "set_loop_bounds()" in gcc/fortran/trans-array.c, the loop
on line 4456 should break immediately after "nonoptional_arr" is set
to "true".

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

        * trans-array.c (set_loop_bounds): Exit loop after
        setting nonoptional_arr.





-Chang
Index: gcc/fortran/trans-array.c
===================================================================
--- gcc/fortran/trans-array.c	(revision 201034)
+++ gcc/fortran/trans-array.c	(working copy)
@@ -4456,7 +4456,10 @@
       for (ss = loop->ss; ss != gfc_ss_terminator; ss = ss->loop_chain)
 	if (ss->info->type != GFC_SS_SCALAR && ss->info->type != GFC_SS_TEMP
 	    && ss->info->type != GFC_SS_REFERENCE && !ss->info->can_be_null_ref)
-	  nonoptional_arr = true;
+	  {
+	    nonoptional_arr = true;
+	    break;
+	  }
 
       /* We use one SS term, and use that to determine the bounds of the
 	 loop for this dimension.  We try to pick the simplest term.  */

Comments

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

jeff
diff mbox

Patch

Index: gcc/fortran/trans-array.c
===================================================================
--- gcc/fortran/trans-array.c	(revision 201034)
+++ gcc/fortran/trans-array.c	(working copy)
@@ -4456,7 +4456,10 @@ 
       for (ss = loop->ss; ss != gfc_ss_terminator; ss = ss->loop_chain)
 	if (ss->info->type != GFC_SS_SCALAR && ss->info->type != GFC_SS_TEMP
 	    && ss->info->type != GFC_SS_REFERENCE && !ss->info->can_be_null_ref)
-	  nonoptional_arr = true;
+	  {
+	    nonoptional_arr = true;
+	    break;
+	  }

       /* We use one SS term, and use that to determine the bounds of the
 	 loop for this dimension.  We try to pick the simplest term.  */