commit:     9dd46ee2eb01d30892f1c6db1599e82a9c6e8b04
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Tue Jul  8 18:41:29 2025 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Tue Jul  8 18:41:29 2025 +0000
URL:        https://gitweb.gentoo.org/proj/gcc-patches.git/commit/?id=9dd46ee2

15.1.0: fix Qt vs PTA

Bug: https://bugs.gentoo.org/956308
Bug: https://gcc.gnu.org/PR120358
Signed-off-by: Sam James <sam <AT> gentoo.org>

 15.1.0/gentoo/86_all_PR120358-qt-pta.patch | 47 ++++++++++++++++++++++++++++++
 15.1.0/gentoo/README.history               |  4 +++
 2 files changed, 51 insertions(+)

diff --git a/15.1.0/gentoo/86_all_PR120358-qt-pta.patch 
b/15.1.0/gentoo/86_all_PR120358-qt-pta.patch
new file mode 100644
index 0000000..1a9c974
--- /dev/null
+++ b/15.1.0/gentoo/86_all_PR120358-qt-pta.patch
@@ -0,0 +1,47 @@
+https://bugs.gentoo.org/956308
+https://gcc.gnu.org/PR120358
+https://gcc.gnu.org/cgit/gcc/commit/?id=aa5ae523e84a97bf3a582ea0fa73d959afa9b9c7
+
+From aa5ae523e84a97bf3a582ea0fa73d959afa9b9c7 Mon Sep 17 00:00:00 2001
+Message-ID: 
<aa5ae523e84a97bf3a582ea0fa73d959afa9b9c7.1751999489.git....@gentoo.org>
+From: Richard Biener <[email protected]>
+Date: Mon, 7 Jul 2025 15:13:38 +0200
+Subject: [PATCH] tree-optimization/120358 - bogus PTA with structure access
+
+When we compute the constraint for something like
+MEM[(const struct QStringView &)&tok2 + 32] we go and compute
+what (const struct QStringView &)&tok2 + 32 points to and then
+add subvariables to its dereference that possibly fall in the
+range of the access according to the original refs size.  In
+doing that we disregarded that the subvariable the starting
+address points to might not be aligned to it and thus the
+access might start at any point within that variable.  The following
+conservatively adjusts the pruning of adjacent sub-variables to
+honor this.
+
+       PR tree-optimization/120358
+       * tree-ssa-structalias.cc (get_constraint_for_1): Adjust
+       pruning of sub-variables according to the imprecise
+       known start offset.
+---
+ gcc/tree-ssa-structalias.cc | 5 ++++-
+ 1 file changed, 4 insertions(+), 1 deletion(-)
+
+diff --git a/gcc/tree-ssa-structalias.cc b/gcc/tree-ssa-structalias.cc
+index deca44ae0bf3..0215243d5be9 100644
+--- a/gcc/tree-ssa-structalias.cc
++++ b/gcc/tree-ssa-structalias.cc
+@@ -3690,7 +3690,10 @@ get_constraint_for_1 (tree t, vec<ce_s> *results, bool 
address_p,
+                   size = -1;
+                 for (; curr; curr = vi_next (curr))
+                   {
+-                    if (curr->offset - vi->offset < size)
++                    /* The start of the access might happen anywhere
++                       within vi, so conservatively assume it was
++                       at its end.  */
++                    if (curr->offset - (vi->offset + vi->size - 1) < size)
+                       {
+                         cs.var = curr->id;
+                         results->safe_push (cs);
+-- 
+2.50.0

diff --git a/15.1.0/gentoo/README.history b/15.1.0/gentoo/README.history
index 06c2ba7..c55fe4f 100644
--- a/15.1.0/gentoo/README.history
+++ b/15.1.0/gentoo/README.history
@@ -1,3 +1,7 @@
+2      7 July 2025
+
+       + 86_all_PR120358-qt-pta.patch
+
 1      7 May 2025
 
        + 01_all_default-fortify-source.patch

Reply via email to