From 73fca3329899344a7f85e20b62abc0595f3137d0 Mon Sep 17 00:00:00 2001 From: Marek Polacek Date: Fri, 9 Jun 2023 14:05:21 -0400 Subject: [PATCH] 11.4.1-2.1 Fix ICE on pr96024.f90 on big-endian hosts (PR fortran/96024) Resolves: #2213211 --- gcc.spec | 7 ++++++- gcc11-pr96024.patch | 40 ++++++++++++++++++++++++++++++++++++++++ 2 files changed, 46 insertions(+), 1 deletion(-) create mode 100644 gcc11-pr96024.patch diff --git a/gcc.spec b/gcc.spec index 777a70b..e2bbbbc 100644 --- a/gcc.spec +++ b/gcc.spec @@ -128,7 +128,7 @@ Summary: Various compilers (C, C++, Objective-C, ...) Name: gcc Version: %{gcc_version} -Release: %{gcc_release}%{?dist} +Release: %{gcc_release}.1%{?dist} # libgcc, libgfortran, libgomp, libstdc++ and crtstuff have # GCC Runtime Exception. License: GPLv3+ and GPLv3+ with exceptions and GPLv2+ with exceptions and LGPLv2+ and BSD @@ -291,6 +291,7 @@ Patch27: gcc11-s390x-regarg-1.patch Patch28: gcc11-s390x-regarg-2.patch Patch29: gcc11-s390x-regarg-3.patch Patch30: gcc11-testsuite-fixes.patch +Patch31: gcc11-pr96024.patch Patch100: gcc11-fortran-fdec-duplicates.patch Patch101: gcc11-fortran-flogical-as-integer.patch @@ -887,6 +888,7 @@ mark them as cross compiled. %patch28 -p1 -b .s390x-regarg-2~ %patch29 -p1 -b .s390x-regarg-3~ %patch30 -p1 -b .testsuite~ +%patch31 -p1 -b .pr96024~ %if 0%{?rhel} >= 9 %patch100 -p1 -b .fortran-fdec-duplicates~ @@ -3580,6 +3582,9 @@ end %endif %changelog +* Fri Jun 9 2023 Marek Polacek 11.4.1-2.1 +- fix ICE on pr96024.f90 on big-endian hosts (PR fortran/96024, #2213211) + * Mon Jun 5 2023 Marek Polacek 11.4.1-2 - update from releases/gcc-11-branch (#2193180) - GCC 11.4 release diff --git a/gcc11-pr96024.patch b/gcc11-pr96024.patch new file mode 100644 index 0000000..fd883f1 --- /dev/null +++ b/gcc11-pr96024.patch @@ -0,0 +1,40 @@ +commit 7f875e435b23dfb439bc7784cade4aebbd5d4a69 +Author: Jakub Jelinek +Date: Fri Jun 9 09:10:29 2023 +0200 + + 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 + + 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) + +diff --git a/gcc/fortran/primary.c b/gcc/fortran/primary.c +index 1b93f96367f..5cad2d2682b 100644 +--- a/gcc/fortran/primary.c ++++ b/gcc/fortran/primary.c +@@ -3188,10 +3188,11 @@ gfc_convert_to_structure_constructor (gfc_expr *e, gfc_symbol *sym, gfc_expr **c + goto cleanup; + + /* For a constant string constructor, make sure the length is +- correct; truncate of fill with blanks if needed. */ ++ correct; truncate or fill with blanks if needed. */ + if (this_comp->ts.type == BT_CHARACTER && !this_comp->attr.allocatable + && this_comp->ts.u.cl && this_comp->ts.u.cl->length + && this_comp->ts.u.cl->length->expr_type == EXPR_CONSTANT ++ && this_comp->ts.u.cl->length->ts.type == BT_INTEGER + && actual->expr->ts.type == BT_CHARACTER + && actual->expr->expr_type == EXPR_CONSTANT) + {