diff mbox

[fortran] Fix regression with inline matmul

Message ID cf41f487-8192-26d2-6c31-7d2d80db5527@netcologne.de
State New
Headers show

Commit Message

Thomas Koenig Aug. 26, 2017, 6:24 p.m. UTC
Hello world,

to relieve the boredom on the fortran mailing list and to fix
a regression I thought I'd submit a patch :-)

Apparently, a call to CONJG wasn't picking up the right
typespec, which led to an ICE with gimplification later.

Regression-tested.  OK for trunk?

Regards

	Thomas

2017-08-26  Thomas Koenig  <tkoenig@gcc.gnu.org>

         PR fortran/81974
         * frontend-passes (inline_matumul_assign):  Explicity
         set typespec for call to CONJG.

2017-08-26  Thomas Koenig  <tkoenig@gcc.gnu.org>

         PR fortran/81974
         * gfortran.dg/inline_matmul_19.f90:  New test

Comments

Jerry DeLisle Aug. 26, 2017, 7:27 p.m. UTC | #1
On 08/26/2017 11:24 AM, Thomas Koenig wrote:
> Hello world,
> 
> to relieve the boredom on the fortran mailing list and to fix
> a regression I thought I'd submit a patch :-)
> 
> Apparently, a call to CONJG wasn't picking up the right
> typespec, which led to an ICE with gimplification later.
> 
> Regression-tested.  OK for trunk?
> 

OK for Trunk, and backport to 7.3 if the bug is there.

Thanks,

Jerry
diff mbox

Patch

Index: frontend-passes.c
===================================================================
--- frontend-passes.c	(Revision 251125)
+++ frontend-passes.c	(Arbeitskopie)
@@ -3837,14 +3837,25 @@  inline_matmul_assign (gfc_code **c, int *walk_subt
       gcc_unreachable();
     }
 
+  /* Build the conjg call around the variables.  Set the typespec manually
+     because gfc_build_intrinsic_call sometimes gets this wrong.  */
   if (conjg_a)
-    ascalar = gfc_build_intrinsic_call (ns, GFC_ISYM_CONJG, "conjg",
-					matrix_a->where, 1, ascalar);
+    {
+      gfc_typespec ts;
+      ts = matrix_a->ts;
+      ascalar = gfc_build_intrinsic_call (ns, GFC_ISYM_CONJG, "conjg",
+					  matrix_a->where, 1, ascalar);
+      ascalar->ts = ts;
+    }
 
   if (conjg_b)
-    bscalar = gfc_build_intrinsic_call (ns, GFC_ISYM_CONJG, "conjg",
-					matrix_b->where, 1, bscalar);
-
+    {
+      gfc_typespec ts;
+      ts = matrix_b->ts;
+      bscalar = gfc_build_intrinsic_call (ns, GFC_ISYM_CONJG, "conjg",
+					  matrix_b->where, 1, bscalar);
+      bscalar->ts = ts;
+    }
   /* First loop comes after the zero assignment.  */
   assign_zero->next = do_1;