[Bug fortran/46896] [4.2/4.3/4.4/4.5/4/6 Regression] Wrong code with transpose(a) passed to subroutine

jvdelisle at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Sun Dec 12 00:39:00 GMT 2010


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

Jerry DeLisle <jvdelisle at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|4.6.0                       |---

--- Comment #3 from Jerry DeLisle <jvdelisle at gcc dot gnu.org> 2010-12-12 00:38:53 UTC ---
This preliminary patch fixes it.

Index: trans-array.c
===================================================================
--- trans-array.c    (revision 167715)
+++ trans-array.c    (working copy)
@@ -5419,17 +5419,6 @@ gfc_conv_expr_descriptor (gfc_se * se, gfc_expr *

     case EXPR_FUNCTION:

-      /* We don't need to copy data in some cases.  */
-      arg = gfc_get_noncopying_intrinsic_argument (expr);
-      if (arg)
-    {
-      /* This is a call to transpose...  */
-      gcc_assert (expr->value.function.isym->id == GFC_ISYM_TRANSPOSE);
-      /* ... which has already been handled by the scalarizer, so
-         that we just need to get its argument's descriptor.  */
-      gfc_conv_expr_descriptor (se, expr->value.function.actual->expr, ss);
-      return;
-    }

       /* A transformational function return value will be a temporary
      array descriptor.  We still need to go through the scalarizer
@@ -5452,14 +5441,6 @@ gfc_conv_expr_descriptor (gfc_se * se, gfc_expr *

       if (ss->expr != expr || ss->type != GFC_SS_FUNCTION)
     {
-      if (ss->expr != expr)
-        /* Elemental function.  */
-        gcc_assert ((expr->value.function.esym != NULL
-             && expr->value.function.esym->attr.elemental)
-            || (expr->value.function.isym != NULL
-                && expr->value.function.isym->elemental));
-      else
-        gcc_assert (ss->type == GFC_SS_INTRINSIC);

       need_tmp = 1;
       if (expr->ts.type == BT_CHARACTER

The first hunk gets rid of the bypassing where it is assumed the scalarizer
handled it.

The second hunk just lets compilation continue by removing the asserts which
assume function attributes.

I am not suggesting this is the right way to fix this.  It just identified the
general area that needs to be refined.



More information about the Gcc-bugs mailing list