]> git.ipfire.org Git - thirdparty/gcc.git/commit
fortran: Fix ICE on pr96024.f90 on big-endian hosts [PR96024]
authorJakub Jelinek <jakub@redhat.com>
Fri, 9 Jun 2023 07:10:29 +0000 (09:10 +0200)
committerJakub Jelinek <jakub@redhat.com>
Fri, 9 Jun 2023 08:01:24 +0000 (10:01 +0200)
commitf46b16ef25fec4f936724ca449259db5c3de0f54
treed356ef78e5a831274cf9631bb686e31f8b17cd1c
parent3d52220f3ac85776109bfb9a1c8de5eeda2c9ca9
fortran: Fix ICE on pr96024.f90 on big-endian hosts [PR96024]

The pr96024.f90 testcase ICEs on big-endian hosts.  The problem is
that length->val.integer is accessed after checking
length->expr_type == EXPR_CONSTANT, but it is a CHARACTER constant
which uses length->val.character union member instead and on big-endian
we end up reading constant 0x100000000 rather than some small number
on little-endian and if target doesn't have enough memory for 4 times
that (i.e. 16GB allocation), it ICEs.

2023-06-09  Jakub Jelinek  <jakub@redhat.com>

PR fortran/96024
* primary.c (gfc_convert_to_structure_constructor): Only do
constant string ctor length verification and truncation/padding
if constant length has INTEGER type.

(cherry picked from commit 4cf6e322adc19f927859e0a5edfa93cec4b8c844)
gcc/fortran/primary.c