https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91782

anlauf at gcc dot gnu.org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |anlauf at gcc dot gnu.org

--- Comment #3 from anlauf at gcc dot gnu.org ---
I am now getting the following results for the testcase in comment#0:

gfortran 8.4.1, 9.3.1:

 aaa
 aaa
 aaa
          97          97          97
           1           1           1


10.2.1 as of 20210116:

pr91782-z1.f90:7:20:

    7 |   print *, ichar(([(x(1:i), i=1,3)]))
      |                    1
Error: Argument of ICHAR at (1) must be of length one
pr91782-z1.f90:7:20:

    7 |   print *, ichar(([(x(1:i), i=1,3)]))
      |                    1
Error: Argument of ICHAR at (1) must be of length one


11 trunk:

pr91782-z1.f90:4:23:

    4 |   print *, ['abc'(1:1), 'abc'(1:2), 'abc'(1:3)]
      |                       1
Error: Different CHARACTER lengths (1/2) in array constructor at (1)
pr91782-z1.f90:7:20:

    7 |   print *, ichar(([(x(1:i), i=1,3)]))
      |                    1
Error: Argument of ICHAR at (1) must be of length one
pr91782-z1.f90:7:20:

    7 |   print *, ichar(([(x(1:i), i=1,3)]))
      |                    1
Error: Argument of ICHAR at (1) must be of length one


I think the new error for line 4 is a consequence of the patch applied for
pr93340.


What is left is apparently the following issue:

program p
  integer :: i
  character(3), parameter :: x = 'abc'
  print *, [x(1:1), x(1:2), x(1:3)]
  print *, [(x(1:i), i=1,3)]           ! this one gives no warning
end

which prints:

 aaa
 aaa

but it is rejected with -std=f2018:

pr91782-z1.f90:4:19:

    4 |   print *, [x(1:1), x(1:2), x(1:3)]
      |                   1
Error: The CHARACTER elements of the array constructor at (1) must have the
same length (2/1)
pr91782-z1.f90:4:27:

    4 |   print *, [x(1:1), x(1:2), x(1:3)]
      |                           1
Error: The CHARACTER elements of the array constructor at (1) must have the
same length (3/1)

Reply via email to