From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: <gentoo-commits+bounces-1684242-garchives=archives.gentoo.org@lists.gentoo.org> Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by finch.gentoo.org (Postfix) with ESMTPS id A8D18158042 for <garchives@archives.gentoo.org>; Mon, 28 Oct 2024 21:32:41 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 12414E0819; Mon, 28 Oct 2024 21:32:41 +0000 (UTC) Received: from smtp.gentoo.org (mail.gentoo.org [IPv6:2001:470:ea4a:1:5054:ff:fec7:86e4]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id EE551E0819 for <gentoo-commits@lists.gentoo.org>; Mon, 28 Oct 2024 21:32:40 +0000 (UTC) Received: from oystercatcher.gentoo.org (oystercatcher.gentoo.org [148.251.78.52]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id 3A34E3430CB for <gentoo-commits@lists.gentoo.org>; Mon, 28 Oct 2024 21:32:40 +0000 (UTC) Received: from localhost.localdomain (localhost [IPv6:::1]) by oystercatcher.gentoo.org (Postfix) with ESMTP id BB96DB03 for <gentoo-commits@lists.gentoo.org>; Mon, 28 Oct 2024 21:32:38 +0000 (UTC) From: "Sam James" <sam@gentoo.org> To: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: 8bit Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "Sam James" <sam@gentoo.org> Message-ID: <1730151138.a0691e3578dcab1c745e963bb4f9ffe2a3889cf3.sam@gentoo> Subject: [gentoo-commits] proj/gcc-patches:master commit in: 15.0.0/gentoo/ X-VCS-Repository: proj/gcc-patches X-VCS-Files: 15.0.0/gentoo/72_all_PR117313-linux.patch X-VCS-Directories: 15.0.0/gentoo/ X-VCS-Committer: sam X-VCS-Committer-Name: Sam James X-VCS-Revision: a0691e3578dcab1c745e963bb4f9ffe2a3889cf3 X-VCS-Branch: master Date: Mon, 28 Oct 2024 21:32:38 +0000 (UTC) Precedence: bulk List-Post: <mailto:gentoo-commits@lists.gentoo.org> List-Help: <mailto:gentoo-commits+help@lists.gentoo.org> List-Unsubscribe: <mailto:gentoo-commits+unsubscribe@lists.gentoo.org> List-Subscribe: <mailto:gentoo-commits+subscribe@lists.gentoo.org> List-Id: Gentoo Linux mail <gentoo-commits.gentoo.org> X-BeenThere: gentoo-commits@lists.gentoo.org X-Auto-Response-Suppress: DR, RN, NRN, OOF, AutoReply X-Archives-Salt: 006a07b1-56fa-4eee-9e82-11505d03d6b0 X-Archives-Hash: f9191a70cd64daab2013c4ac64386871 commit: a0691e3578dcab1c745e963bb4f9ffe2a3889cf3 Author: Sam James <sam <AT> gentoo <DOT> org> AuthorDate: Mon Oct 28 21:32:18 2024 +0000 Commit: Sam James <sam <AT> gentoo <DOT> org> CommitDate: Mon Oct 28 21:32:18 2024 +0000 URL: https://gitweb.gentoo.org/proj/gcc-patches.git/commit/?id=a0691e35 15.0.0: add 72_all_PR117313-linux.patch Bug: https://gcc.gnu.org/PR117313 Signed-off-by: Sam James <sam <AT> gentoo.org> 15.0.0/gentoo/72_all_PR117313-linux.patch | 104 ++++++++++++++++++++++++++++++ 1 file changed, 104 insertions(+) diff --git a/15.0.0/gentoo/72_all_PR117313-linux.patch b/15.0.0/gentoo/72_all_PR117313-linux.patch new file mode 100644 index 0000000..c8cb2e8 --- /dev/null +++ b/15.0.0/gentoo/72_all_PR117313-linux.patch @@ -0,0 +1,104 @@ +2024-10-28 Jakub Jelinek <jakub@redhat.com> + + PR c/117313 +gcc/c-family/ + * c-common.cc (complete_array_type): For RAW_DATA_CST elements + advance curindex by RAW_DATA_LENGTH or one less than that if + ce->index is non-NULL. Handle even the first element if + it is RAW_DATA_CST. Formatting fix. +gcc/testsuite/ + * c-c++-common/init-6.c: New test. + +--- a/gcc/c-family/c-common.cc 2024-10-27 16:39:55.090871381 +0100 ++++ b/gcc/c-family/c-common.cc 2024-10-28 12:30:01.215814079 +0100 +@@ -7044,7 +7044,8 @@ complete_array_type (tree *ptype, tree i + { + int eltsize + = int_size_in_bytes (TREE_TYPE (TREE_TYPE (initial_value))); +- maxindex = size_int (TREE_STRING_LENGTH (initial_value)/eltsize - 1); ++ maxindex = size_int (TREE_STRING_LENGTH (initial_value) / eltsize ++ - 1); + } + else if (TREE_CODE (initial_value) == CONSTRUCTOR) + { +@@ -7059,23 +7060,25 @@ complete_array_type (tree *ptype, tree i + else + { + tree curindex; +- unsigned HOST_WIDE_INT cnt; ++ unsigned HOST_WIDE_INT cnt = 1; + constructor_elt *ce; + bool fold_p = false; + + if ((*v)[0].index) + maxindex = (*v)[0].index, fold_p = true; ++ if (TREE_CODE ((*v)[0].value) == RAW_DATA_CST) ++ cnt = 0; + + curindex = maxindex; + +- for (cnt = 1; vec_safe_iterate (v, cnt, &ce); cnt++) ++ for (; vec_safe_iterate (v, cnt, &ce); cnt++) + { + bool curfold_p = false; + if (ce->index) + curindex = ce->index, curfold_p = true; +- else ++ if (!ce->index || TREE_CODE (ce->value) == RAW_DATA_CST) + { +- if (fold_p) ++ if (fold_p || curfold_p) + { + /* Since we treat size types now as ordinary + unsigned types, we need an explicit overflow +@@ -7083,9 +7086,16 @@ complete_array_type (tree *ptype, tree i + tree orig = curindex; + curindex = fold_convert (sizetype, curindex); + overflow_p |= tree_int_cst_lt (curindex, orig); ++ curfold_p = false; + } +- curindex = size_binop (PLUS_EXPR, curindex, +- size_one_node); ++ if (TREE_CODE (ce->value) == RAW_DATA_CST) ++ curindex ++ = size_binop (PLUS_EXPR, curindex, ++ size_int (RAW_DATA_LENGTH (ce->value) ++ - (ce->index ? 1 : 0))); ++ else ++ curindex = size_binop (PLUS_EXPR, curindex, ++ size_one_node); + } + if (tree_int_cst_lt (maxindex, curindex)) + maxindex = curindex, fold_p = curfold_p; +--- a/gcc/testsuite/c-c++-common/init-6.c 2024-10-28 12:35:59.526803017 +0100 ++++ b/gcc/testsuite/c-c++-common/init-6.c 2024-10-28 12:35:50.394930729 +0100 +@@ -0,0 +1,29 @@ ++/* PR c/117313 */ ++/* { dg-do compile } */ ++/* { dg-options "-O2" } */ ++ ++struct S { unsigned a; const unsigned char b[]; }; ++struct S s = { ++ 1, ++ { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7e, 0x81, 0xa5, ++ 0x81, 0xbd, 0x99, 0x81, 0x7e, 0x7e, 0xff, 0xdb, 0xff, 0xc3, 0xe7, ++ 0xff, 0x7e, 0x6c, 0xfe, 0xfe, 0xfe, 0x7c, 0x38, 0x10, 0x00, 0x10, ++ 0x38, 0x00, 0x00, 0x38, 0x6c, 0x6c, 0x38, 0x00, 0x00, 0x00, 0x00, ++ 0x00, 0x00, 0x00, 0x18, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, ++ 0x18, 0x00, 0x00, 0x00, 0x00, 0x0c, 0x0c, 0x0c, 0xec, 0x6c, 0x3c, ++ } ++}; ++struct S t = { ++ 2, ++ { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7e, 0x81, 0xa5, ++ 0x81, 0xbd, 0x99, 0x81, 0x7e, 0x7e, 0xff, 0xdb, 0xff, 0xc3, 0xe7, ++ 0xff, 0x7e, 0x6c, 0xfe, 0xfe, 0xfe, 0x7c, 0x38, 0x10, 0x00, 0x10, ++ 0x38, 0x00, 0x00, 0x38, 0x6c, 0x6c, 0x38, 0x00, 0x00, 0x00, 0x00, ++ 0x00, 0x00, 0x00, 0x18, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, ++ 0x18, 0x00, 0x00, 0x00, 0x00, 0x0c, 0x0c, 0x0c, 0xec, 0x6c, 0x3c, ++ 0xff, 0x7e, 0x6c, 0xfe, 0xfe, 0xfe, 0x7c, 0x38, 0x10, 0x00, 0x10, ++ 0x38, 0x00, 0x00, 0x38, 0x6c, 0x6c, 0x38, 0x00, 0x00, 0x00, 0x00, ++ 0x00, 0x00, 0x00, 0x18, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, ++ 0x18, 0x00, 0x00, 0x00, 0x00, 0x0c, 0x0c, 0x0c, 0xec, 0x6c, 0x3c ++ } ++};