From 649de7699461ffae339ecd2b20ad6e67929a1535 Mon Sep 17 00:00:00 2001 From: Michal Klocek Date: Tue, 9 Jul 2024 11:04:22 +0200 Subject: [PATCH] Fix cross compiler crash when compiling qtwebengine The compilation distributed_point_functions project crashes compiler. It issue is reported and solved here: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110280 Apply the patch as it released for 13.3 Fixes: QTBUG-126655 Change-Id: I999643f9e336af7dd98849897a18c731340ea932 Reviewed-by: Mikko Gronoff --- recipes-devtools/gcc/gcc-source_%.bbappend | 5 ++ .../gcc/tree-optimization.110280.patch | 64 +++++++++++++++++++ 2 files changed, 69 insertions(+) create mode 100644 recipes-devtools/gcc/gcc-source_%.bbappend create mode 100644 recipes-devtools/gcc/tree-optimization.110280.patch diff --git a/recipes-devtools/gcc/gcc-source_%.bbappend b/recipes-devtools/gcc/gcc-source_%.bbappend new file mode 100644 index 0000000..56dbbb6 --- /dev/null +++ b/recipes-devtools/gcc/gcc-source_%.bbappend @@ -0,0 +1,5 @@ +FILESEXTRAPATHS:prepend := "${THISDIR}:" +PATCH_GCC ?= "${@bb.utils.contains_any('DISTRO_CODENAME', 'styhead nanbield', bb.utils.vercmp_string_op(d.getVar('GCCVERSION'), '13', '>='), '0', d)}" +SRC_URI += " \ + ${@'file://tree-optimization.110280.patch' if bb.utils.to_boolean(d.getVar('PATCH_GCC')) else ''} \ + " diff --git a/recipes-devtools/gcc/tree-optimization.110280.patch b/recipes-devtools/gcc/tree-optimization.110280.patch new file mode 100644 index 0000000..280ffa5 --- /dev/null +++ b/recipes-devtools/gcc/tree-optimization.110280.patch @@ -0,0 +1,64 @@ +From f4029de35fb1b293a4fd586574b1b4b73ddf7880 Mon Sep 17 00:00:00 2001 +From: Prathamesh Kulkarni +Date: Wed, 26 Jul 2023 22:36:26 +0530 +Subject: [PATCH] [aarch64/match.pd] Fix ICE observed in PR110280. + +gcc/ChangeLog: + PR tree-optimization/110280 + * match.pd (vec_perm_expr(v, v, mask) -> v): Explicitly build vector + using build_vector_from_val with the element of input operand, and + mask's type if operand and mask's types don't match. + +gcc/testsuite/ChangeLog: + PR tree-optimization/110280 + * gcc.target/aarch64/sve/pr110280.c: New test. + +(cherry picked from commit 85d8e0d8d5342ec8b4e6a54e22741c30b33c6f04) + +Upstream-Status: Pending +--- + gcc/match.pd | 9 ++++++++- + gcc/testsuite/gcc.target/aarch64/sve/pr110280.c | 12 ++++++++++++ + 2 files changed, 20 insertions(+), 1 deletion(-) + create mode 100644 gcc/testsuite/gcc.target/aarch64/sve/pr110280.c +diff --git a/gcc/match.pd b/gcc/match.pd +index 911824482505..c3bb4fbc0a7a 100644 +--- a/gcc/match.pd ++++ b/gcc/match.pd +@@ -8292,7 +8292,14 @@ and, + + (simplify + (vec_perm vec_same_elem_p@0 @0 @1) +- @0) ++ (if (types_match (type, TREE_TYPE (@0))) ++ @0 ++ (with ++ { ++ tree elem = uniform_vector_p (@0); ++ } ++ (if (elem) ++ { build_vector_from_val (type, elem); })))) + + /* Push VEC_PERM earlier if that may help FMA perception (PR101895). */ + (simplify +diff --git a/gcc/testsuite/gcc.target/aarch64/sve/pr110280.c b/gcc/testsuite/gcc.target/aarch64/sve/pr110280.c +new file mode 100644 +index 000000000000..d3279f383629 +--- /dev/null ++++ b/gcc/testsuite/gcc.target/aarch64/sve/pr110280.c +@@ -0,0 +1,12 @@ ++/* { dg-do compile } */ ++/* { dg-options "-O3 -fdump-tree-optimized" } */ ++ ++#include "arm_sve.h" ++ ++svuint32_t l() ++{ ++ _Alignas(16) const unsigned int lanes[4] = {0, 0, 0, 0}; ++ return svld1rq_u32(svptrue_b8(), lanes); ++} ++ ++/* { dg-final { scan-tree-dump-not "VEC_PERM_EXPR" "optimized" } } */ +-- +2.43.5 +