This is the mail archive of the mailing list for the GCC project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Patch, PR57803] Wasted work in gfc_build_dummy_array_decl()


The problem appears in revision 201034 in version 4.9.  I attached a
one-line patch that fixes it.  I also reported this problem

I bootstrapped and ran the regression tests for this patch on x86_64-linux
and all tests pass.

In method "gfc_build_dummy_array_decl()" in gcc/fortran/trans-decl.c,
the loop on line 978 should break immediately after "packed" is set to
"PACKED_PARTIAL". All the iterations after "packed" set to
"PACKED_PARTIAL" do not perform any useful work, at best they just set
"packed" again to "PACKED_PARTIAL".

Index: gcc/fortran/trans-decl.c
--- gcc/fortran/trans-decl.c	(revision 201034)
+++ gcc/fortran/trans-decl.c	(working copy)
@@ -975,7 +975,10 @@
 			&& as->lower[n]
 			&& as->upper[n]->expr_type == EXPR_CONSTANT
 			&& as->lower[n]->expr_type == EXPR_CONSTANT))
-		    packed = PACKED_PARTIAL;
+		    {
+		      packed = PACKED_PARTIAL;
+		      break;
+		    }


Attachment: pr57803_patch.diff
Description: Text document

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]