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/32962] b = conjg(transpose(a)) is erroneous if b is an allocatable array



------- Comment #11 from pault at gcc dot gnu dot org  2007-08-08 16:34 -------
The patch below fixes this problem and all its variants.  It regtests, except
for allocatable_function_1.f90.  This runs OK but the number of free's goes up
from 10 to 11; hence the failure on exepecting 10 of them.  I need to
understand why this is happening - I believe that it is because an extra call
to SIZE is required for on of the scalarizer loops.  Also, I want to see if
there is a neater way of fixing the problem.

In summary, the problem lies with the scalarizer and can be fixed in
gfc_conv_loop_setup.

Paul

Index: /svn/trunk/gcc/fortran/trans-array.c
===================================================================
*** /svn/trunk/gcc/fortran/trans-array.c        (revision 127212)
--- /svn/trunk/gcc/fortran/trans-array.c        (working copy)
*************** gfc_conv_loop_setup (gfc_loopinfo * loop
*** 3220,3226 ****
          /* Criteria for choosing a loop specifier (most important first):
             doesn't need realloc
             stride of one
!            known stride
             known lower bound
             known upper bound
           */
--- 3220,3226 ----
          /* Criteria for choosing a loop specifier (most important first):
             doesn't need realloc
             stride of one
!            known stride (preferably a variable)
             known lower bound
             known upper bound
           */
*************** gfc_conv_loop_setup (gfc_loopinfo * loop
*** 3232,3237 ****
--- 3232,3241 ----
          else if (INTEGER_CST_P (info->stride[n])
                   && !INTEGER_CST_P (specinfo->stride[n]))
            loopspec[n] = ss;
+         else if (INTEGER_CST_P (info->stride[n])
+                  && ss->expr->expr_type == EXPR_VARIABLE
+                  && loopspec[n]->expr->expr_type != EXPR_VARIABLE)
+           loopspec[n] = ss;
          else if (INTEGER_CST_P (info->start[n])
                   && !INTEGER_CST_P (specinfo->start[n]))
            loopspec[n] = ss;


-- 

pault at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         AssignedTo|unassigned at gcc dot gnu   |pault at gcc dot gnu dot org
                   |dot org                     |
             Status|NEW                         |ASSIGNED
   Last reconfirmed|2007-08-02 05:42:20         |2007-08-08 16:34:50
               date|                            |


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


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