public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [patch, fortran, committed] Fix PR 83224
@ 2017-12-01  7:38 Thomas Koenig
  0 siblings, 0 replies; only message in thread
From: Thomas Koenig @ 2017-12-01  7:38 UTC (permalink / raw)
  To: fortran, gcc-patches

[-- Attachment #1: Type: text/plain, Size: 434 bytes --]

Hello world,

I just committed the attached patch as obvious and simple to trunk,
r255294.

Regards

	Thomas

2017-12-01  Thomas Koenig  <tkoenig@gcc.gnu.org>

         PR fortran/83224
         * frontend-passes.c (realloc_string_callback): Handle
         case for which the RHS is an array expression.

2017-12-01  Thomas Koenig  <tkoenig@gcc.gnu.org>

         PR fortran/83224
         * gfortran.dg/dependency_50.f90: New test.

[-- Attachment #2: p1.diff --]
[-- Type: text/x-patch, Size: 873 bytes --]

Index: frontend-passes.c
===================================================================
--- frontend-passes.c	(Revision 255181)
+++ frontend-passes.c	(Arbeitskopie)
@@ -249,7 +249,7 @@ realloc_string_callback (gfc_code **c, int *walk_s
     return 0;
 
   expr1 = co->expr1;
-  if (expr1->ts.type != BT_CHARACTER || expr1->rank != 0
+  if (expr1->ts.type != BT_CHARACTER
       || !gfc_expr_attr(expr1).allocatable
       || !expr1->ts.deferred)
     return 0;
@@ -270,8 +270,9 @@ realloc_string_callback (gfc_code **c, int *walk_s
       if (!found_substr)
 	return 0;
     }
-  else if (expr2->expr_type != EXPR_OP
-	   || expr2->value.op.op != INTRINSIC_CONCAT)
+  else if (expr2->expr_type != EXPR_ARRAY
+	   && (expr2->expr_type != EXPR_OP
+	       || expr2->value.op.op != INTRINSIC_CONCAT))
     return 0;
   
   if (!gfc_check_dependency (expr1, expr2, true))

[-- Attachment #3: dependency_50.f90 --]
[-- Type: text/x-fortran, Size: 370 bytes --]

! { dg-do  run }
! PR 83224 - dependency mishandling with an array constructor
! Original test case by Urban Jost
program dusty_corner
  implicit none
  character(len=:),allocatable :: words(:)

  words=[character(len=3) :: 'one', 'two']
  words=[character(len=5) :: words, 'three']
  if (any(words /= [ "one  ", "two  ", "three"])) call abort

end program dusty_corner

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2017-12-01  7:38 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-12-01  7:38 [patch, fortran, committed] Fix PR 83224 Thomas Koenig

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).