* [patch, fortran] Fix PR 68426, simplification of SPREAD
@ 2019-01-08 23:11 Thomas Koenig
2019-01-09 18:54 ` Steve Kargl
0 siblings, 1 reply; 2+ messages in thread
From: Thomas Koenig @ 2019-01-08 23:11 UTC (permalink / raw)
To: fortran, gcc-patches
[-- Attachment #1: Type: text/plain, Size: 936 bytes --]
Hello world,
the attached patch fixes the PR by simpliy having gfc_simplify_spread
also do its job when there's an EXPR_STRUCTURE. The code to correctly
handle that case was already in place, it just was not run for that
case.
Regression-tested. OK for trunk?
Regards
Thomas
! { dg-do run }
! PR 68426 - simplification used to fail.
module m
implicit none
type t
integer :: i
end type t
type(t), dimension(2), parameter :: a1 = (/ t(1), t(2) /)
type(t), dimension(1), parameter :: c = spread ( a1(1), 1, 1 )
end module m
ig25@flaemmli:~/Krempel/Spread> cat ChangeLog
2019-01-09 Thomas Koenig <tkoenig@gcc.gnu.org>
PR fortran/68426
* simplify.c (gfc_simplify_spread): Also simplify if the
type of source is an EXPR_STRUCTURE.
2019-01-09 Thomas Koenig <tkoenig@gcc.gnu.org>
PR fortran/68426
* gfortran.dg/spread_simplify_1.f90: New test.
[-- Attachment #2: p1.diff --]
[-- Type: text/x-patch, Size: 417 bytes --]
Index: simplify.c
===================================================================
--- simplify.c (Revision 267737)
+++ simplify.c (Arbeitskopie)
@@ -7572,7 +7572,8 @@ gfc_simplify_spread (gfc_expr *source, gfc_expr *d
return NULL;
}
- if (source->expr_type == EXPR_CONSTANT)
+ if (source->expr_type == EXPR_CONSTANT
+ || source->expr_type == EXPR_STRUCTURE)
{
gcc_assert (dim == 0);
[-- Attachment #3: spread_simplify_1.f90 --]
[-- Type: text/x-fortran, Size: 345 bytes --]
! { dg-do run }
! PR 68426 - simplification used to fail.
module m
implicit none
type t
integer :: i
end type t
type(t), dimension(2), parameter :: a1 = (/ t(1), t(2) /)
type(t), dimension(1), parameter :: c = spread ( a1(1), 1, 1 )
end module m
program main
use m
if (c(1)%i /= 1) stop 1
end program main
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [patch, fortran] Fix PR 68426, simplification of SPREAD
2019-01-08 23:11 [patch, fortran] Fix PR 68426, simplification of SPREAD Thomas Koenig
@ 2019-01-09 18:54 ` Steve Kargl
0 siblings, 0 replies; 2+ messages in thread
From: Steve Kargl @ 2019-01-09 18:54 UTC (permalink / raw)
To: Thomas Koenig; +Cc: fortran, gcc-patches
On Wed, Jan 09, 2019 at 12:11:12AM +0100, Thomas Koenig wrote:
>
> the attached patch fixes the PR by simpliy having gfc_simplify_spread
> also do its job when there's an EXPR_STRUCTURE. The code to correctly
> handle that case was already in place, it just was not run for that
> case.
>
> Regression-tested. OK for trunk?
>
Yes.
--
Steve
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2019-01-09 18:54 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-01-08 23:11 [patch, fortran] Fix PR 68426, simplification of SPREAD Thomas Koenig
2019-01-09 18:54 ` Steve Kargl
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).