This is the mail archive of the gcc-bugs@gcc.gnu.org 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]

[Bug fortran/51250] [4.7 Regression] Bug with SUM(,dim,mask)


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=51250

--- Comment #4 from Mikael Morin <mikael at gcc dot gnu.org> 2011-11-23 23:20:16 UTC ---
(In reply to comment #3)
> I will take care of this one after mid-december.
> 
I couldn't help having a look.

diff --git a/gcc/fortran/trans-array.c b/gcc/fortran/trans-array.c
index 2fb2d34..ee8f896 100644
--- a/gcc/fortran/trans-array.c
+++ b/gcc/fortran/trans-array.c
@@ -1087,7 +1087,7 @@ gfc_trans_create_temp_array (stmtblock_t * pre,
stmtblock_t * post, gfc_ss * ss,
     for (s = ss; s; s = s->parent)
       for (n = 0; n < s->loop->dimen; n++)
     {
-      dim = get_scalarizer_dim_for_array_dim (ss, ss->dim[n]);
+      dim = get_scalarizer_dim_for_array_dim (ss, s->dim[n]);

       /* For a callee allocated array express the loop bounds in terms
          of the descriptor fields.  */



This gives the following change in the dump. Then one gets the expected result.

--- comment_0.f90.003t.original.bad    2011-11-24 00:15:42.045565178 +0100
+++ comment_0.f90.003t.original.good    2011-11-24 00:12:16.409796545 +0100
@@ -473,7 +473,7 @@
                           S.18 = 0;
                           while (1)
                             {
-                              if (atmp.17.dim[1].ubound -
atmp.17.dim[1].lbound < S.18) goto L.14;
+                              if (atmp.17.dim[0].ubound -
atmp.17.dim[0].lbound < S.18) goto L.14;
                               {
                                 integer(kind=4) D.2013;
                                 integer(kind=4) val.19;
@@ -608,7 +608,7 @@
                               __builtin_free (D.2035);
                             }
                         }
-                        D.2051 = atmp.23.dim[1].ubound -
atmp.23.dim[1].lbound;
+                        D.2051 = atmp.23.dim[0].ubound -
atmp.23.dim[0].lbound;
                         atmp.24.dtype = 265;
                         atmp.24.dim[0].stride = 1;
                         atmp.24.dim[0].lbound = 0;


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