Fortran: PACK intrinsic should not try to read from zero-sized array
authorHarald Anlauf <anlauf@gmx.de>
Mon, 13 Dec 2021 19:50:19 +0000 (20:50 +0100)
committerHarald Anlauf <anlauf@gmx.de>
Tue, 14 Dec 2021 15:56:50 +0000 (16:56 +0100)
commit1c613165a55b212c59a83796b20a1d555e096504
treeba8584c09200fc8eb9c7fa31566987e6e3a62264
parent3305135c29e1c3e988bd9bad40aefc01d138aaca
Fortran: PACK intrinsic should not try to read from zero-sized array

libgfortran/ChangeLog:

PR libfortran/103634
* intrinsics/pack_generic.c (pack_internal): Handle case when the
array argument of PACK has one or more extents of size zero to
avoid invalid reads.

gcc/testsuite/ChangeLog:

PR libfortran/103634
* gfortran.dg/intrinsic_pack_6.f90: New test.
gcc/testsuite/gfortran.dg/intrinsic_pack_6.f90 [new file with mode: 0644]
libgfortran/intrinsics/pack_generic.c