aboutsummaryrefslogtreecommitdiff
path: root/gcc/cp/constexpr.cc
diff options
context:
space:
mode:
authorJakub Jelinek <jakub@redhat.com>2022-03-25 11:22:15 +0100
committerJakub Jelinek <jakub@redhat.com>2022-03-25 11:22:15 +0100
commit45e955b0a936eafc9838cdc00dcc31b3799b321b (patch)
treefc0a9e127b89cfe032af4371d8d2405e75f9feb3 /gcc/cp/constexpr.cc
parent748f36a48b506f52e10bcdeb750a7fe9c30c26f3 (diff)
downloadgcc-45e955b0a936eafc9838cdc00dcc31b3799b321b.zip
gcc-45e955b0a936eafc9838cdc00dcc31b3799b321b.tar.gz
gcc-45e955b0a936eafc9838cdc00dcc31b3799b321b.tar.bz2
fortran: Fix up initializers of param(0) PARAMETERs [PR103691]
On the gfortran.dg/pr103691.f90 testcase the Fortran ICE emits static real(kind=4) a[0] = {[0 ... -1]=2.0e+0}; That is an invalid RANGE_EXPR where the maximum is smaller than the minimum. The following patch fixes that. If TYPE_MAX_VALUE is smaller than TYPE_MIN_VALUE, the array is empty and so doesn't need any initializer, if the two are equal, we don't need to bother with a RANGE_EXPR and can just use that INTEGER_CST as the index and finally for the 2+ values in the range it uses a RANGE_EXPR as before. 2022-03-25 Jakub Jelinek <jakub@redhat.com> PR fortran/103691 * trans-array.cc (gfc_conv_array_initializer): If TYPE_MAX_VALUE is smaller than TYPE_MIN_VALUE (i.e. empty array), ignore the initializer; if TYPE_MIN_VALUE is equal to TYPE_MAX_VALUE, use just the TYPE_MIN_VALUE as index instead of RANGE_EXPR.
Diffstat (limited to 'gcc/cp/constexpr.cc')
0 files changed, 0 insertions, 0 deletions