[Bug fortran/56423] F08/0071: Shall reject invalid Vector subscript target with Pointer assignment

2018-11-08 Thread gs...@t-online.de
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=56423

G. Steinmetz  changed:

   What|Removed |Added

 CC||gs...@t-online.de

--- Comment #2 from G. Steinmetz  ---

Update, slightly simplified :


$ cat z1.f90
program p
   integer, target :: x(3) = [7, 8, 9]
   type t
  integer, pointer :: a(:)
   end type
   type(t) :: z
   z = t(x([2]))
   print *, z%a
end


$ gfortran-9-20181104 -c z1.f90
z1.f90:7:0:

7 |z = t(x([2]))
  |
internal compiler error: in gfc_conv_expr_descriptor, at
fortran/trans-array.c:7285
0x6d14c3 gfc_conv_expr_descriptor(gfc_se*, gfc_expr*)
../../gcc/fortran/trans-array.c:7285
0x6f2a9b gfc_trans_subcomponent_assign
../../gcc/fortran/trans-expr.c:7485
0x6f375a gfc_trans_structure_assign(tree_node*, gfc_expr*, bool, bool)
../../gcc/fortran/trans-expr.c:7824
0x6edf0f gfc_conv_structure(gfc_se*, gfc_expr*, int)
../../gcc/fortran/trans-expr.c:7891
0x6ee14c gfc_conv_expr(gfc_se*, gfc_expr*)
../../gcc/fortran/trans-expr.c:8059
0x6fc779 gfc_trans_assignment_1
../../gcc/fortran/trans-expr.c:10248
0x6bf54f trans_code
../../gcc/fortran/trans.c:1822
0x6e6e14 gfc_generate_function_code(gfc_namespace*)
../../gcc/fortran/trans-decl.c:6509
0x6740a6 translate_all_program_units
../../gcc/fortran/parse.c:6125
0x6740a6 gfc_parse_file()
../../gcc/fortran/parse.c:6328
0x6bc03f gfc_be_parse_file
../../gcc/fortran/f95-lang.c:204


---

And nearby :


$ cat z2.f90
program p
   integer, target :: x(3) = [7, 8, 9]
   type t
  integer, pointer :: a(:)
   end type
   type(t) :: z
   z = t(x(2))
   print *, z%a
end


$ gfortran-9-20181104 -c z2.f90
z2.f90:7:0:

7 |z = t(x(2))
  |
internal compiler error: in gfc_conv_expr_descriptor, at
fortran/trans-array.c:7090
0x6d14eb gfc_conv_expr_descriptor(gfc_se*, gfc_expr*)
../../gcc/fortran/trans-array.c:7090
0x6f2a9b gfc_trans_subcomponent_assign
../../gcc/fortran/trans-expr.c:7485
0x6f375a gfc_trans_structure_assign(tree_node*, gfc_expr*, bool, bool)
../../gcc/fortran/trans-expr.c:7824
0x6edf0f gfc_conv_structure(gfc_se*, gfc_expr*, int)
../../gcc/fortran/trans-expr.c:7891
0x6ee14c gfc_conv_expr(gfc_se*, gfc_expr*)
../../gcc/fortran/trans-expr.c:8059
0x6fc779 gfc_trans_assignment_1
../../gcc/fortran/trans-expr.c:10248
0x6bf54f trans_code
../../gcc/fortran/trans.c:1822
0x6e6e14 gfc_generate_function_code(gfc_namespace*)
../../gcc/fortran/trans-decl.c:6509
0x6740a6 translate_all_program_units
../../gcc/fortran/parse.c:6125
0x6740a6 gfc_parse_file()
../../gcc/fortran/parse.c:6328
0x6bc03f gfc_be_parse_file
../../gcc/fortran/f95-lang.c:204

[Bug fortran/56423] F08/0071: Shall reject invalid Vector subscript target with Pointer assignment

2015-10-10 Thread dominiq at lps dot ens.fr
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=56423

Dominique d'Humieres  changed:

   What|Removed |Added

 Status|UNCONFIRMED |NEW
   Last reconfirmed||2015-10-10
 Ever confirmed|0   |1
  Known to fail||4.8.5, 4.9.3, 5.2.0, 6.0

--- Comment #1 from Dominique d'Humieres  ---
>From my version of the F2015 draft

C725 (R737) The expr shall be a designator that designates a variable with
either
the TARGET or POINTER attribute and is not an array section with
a vector subscript, or it shall be a reference to a function that
returns a data pointer.

Note that 't(x( [ 1,4,9,25 ] ))' is not rejected but gives an ICE from 4.8 up
to trunk (6.0):

[Book15] f90/bug% gfortran pr56423.f90
pr56423.f90:11:0:

 y = t(x( [ 1,4,9,25 ] ))   ! (4)  ! Invalid per IR F08/0071 but not
rejected
 1
internal compiler error: in gfc_conv_expr_descriptor, at
fortran/trans-array.c:6702

where gfortran is 5.2.0.