backport: re PR fortran/83874 (ICE initializing character array from derived type)
2018-01-17 Harald Anlauf <anlauf@gmx.de> Backport from mainline PR fortran/83874 * decl.c (add_init_expr_to_sym): Do not dereference NULL pointer. 2018-01-17 Harald Anlauf <anlauf@gmx.de> Backport from mainline PR fortran/83874 * gfortran.dg/pr83874.f90: New test. From-SVN: r256829
This commit is contained in:
parent
c9173d486c
commit
a38e64ad03
|
@ -1,4 +1,10 @@
|
||||||
2012-01-13 Steven G. Kargl <kargl@gcc.gnu.org>
|
2018-01-17 Harald Anlauf <anlauf@gmx.de>
|
||||||
|
|
||||||
|
Backport from mainline
|
||||||
|
PR fortran/83874
|
||||||
|
* decl.c (add_init_expr_to_sym): Do not dereference NULL pointer.
|
||||||
|
|
||||||
|
2018-01-13 Steven G. Kargl <kargl@gcc.gnu.org>
|
||||||
|
|
||||||
Backport from mainline
|
Backport from mainline
|
||||||
PR fortran/78814
|
PR fortran/78814
|
||||||
|
|
|
@ -1692,7 +1692,7 @@ add_init_expr_to_sym (const char *name, gfc_expr **initp, locus *var_locus)
|
||||||
}
|
}
|
||||||
else if (init->expr_type == EXPR_ARRAY)
|
else if (init->expr_type == EXPR_ARRAY)
|
||||||
{
|
{
|
||||||
if (init->ts.u.cl)
|
if (init->ts.u.cl && init->ts.u.cl->length)
|
||||||
{
|
{
|
||||||
const gfc_expr *length = init->ts.u.cl->length;
|
const gfc_expr *length = init->ts.u.cl->length;
|
||||||
if (length->expr_type != EXPR_CONSTANT)
|
if (length->expr_type != EXPR_CONSTANT)
|
||||||
|
|
|
@ -1,3 +1,9 @@
|
||||||
|
2018-01-17 Harald Anlauf <anlauf@gmx.de>
|
||||||
|
|
||||||
|
Backport from mainline
|
||||||
|
PR fortran/83874
|
||||||
|
* gfortran.dg/pr83874.f90: New test.
|
||||||
|
|
||||||
2018-01-17 Richard Biener <rguenther@suse.de>
|
2018-01-17 Richard Biener <rguenther@suse.de>
|
||||||
|
|
||||||
Backport from mainline
|
Backport from mainline
|
||||||
|
|
|
@ -0,0 +1,19 @@
|
||||||
|
! { dg-do run }
|
||||||
|
! PR fortran/83874
|
||||||
|
! There was an ICE while initializing the character arrays
|
||||||
|
!
|
||||||
|
! Contributed by Harald Anlauf <anlauf@gmx.de>
|
||||||
|
!
|
||||||
|
program charinit
|
||||||
|
implicit none
|
||||||
|
type t
|
||||||
|
character(len=1) :: name
|
||||||
|
end type t
|
||||||
|
type(t), parameter :: z(2)= [ t ('a'), t ('b') ]
|
||||||
|
character(len=1), parameter :: names1(*) = z% name
|
||||||
|
character(len=*), parameter :: names2(2) = z% name
|
||||||
|
character(len=*), parameter :: names3(*) = z% name
|
||||||
|
if (.not. (names1(1) == "a" .and. names1(2) == "b")) call abort ()
|
||||||
|
if (.not. (names2(1) == "a" .and. names2(2) == "b")) call abort ()
|
||||||
|
if (.not. (names3(1) == "a" .and. names3(2) == "b")) call abort ()
|
||||||
|
end program charinit
|
Loading…
Reference in New Issue