gcc11/gcc11-pr104931.patch
Richard Biener 80c93343f2 - Update to gcc-11 branch head (6a1150d1524aeda3381b21717), git1406
* includes change to adjust gnats idea of the target, fixing
    the build of gprbuild.  [bsc#1196861]
- Add gcc11-pr104931.patch to fix miscompile of embedded premake
  in 0ad on i586.  [bsc#1197065]

OBS-URL: https://build.opensuse.org/package/show/devel:gcc/gcc11?expand=0&rev=385
2022-03-16 15:18:58 +00:00

51 lines
1.7 KiB
Diff

From 841a5f32add8d0c9fd33454e89b67b8fa3ded0c3 Mon Sep 17 00:00:00 2001
From: Richard Biener <rguenther@suse.de>
Date: Wed, 16 Mar 2022 14:53:06 +0100
Subject: [PATCH] tree-optimization/104931 - mitigate niter analysis issue
To: gcc-patches@gcc.gnu.org
The following backports a pointer associating pattern from trunk
that mitigates an issue with number_of_iterations_lt_to_ne in
which context we fail to fold a comparison but succeed in folding
a related subtraction. In the failure mode this results in
a loop wrongly assumed looping with a bogus number of iterations,
resulting in crashing of the premake application on start.
With the backported simplification we are able to fold the
comparison and correctly compute the loop as not iterating.
I have failed to create a standalone testcase. I belive part
of the issue is still latent but I have failed to nail down
the issue exactly. Still I believe the backporting of the
mitigation patch is the most sensible and safe thing at this
point.
2022-03-16 Richard Biener <rguenther@suse.de>
PR tree-optimization/104931
* match.pd ((ptr) (x p+ y) p+ z -> (ptr) (x p+ (y + z))): New GENERIC
simplification.
---
gcc/match.pd | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/gcc/match.pd b/gcc/match.pd
index 05a08d0f96a..a005dcd42bd 100644
--- a/gcc/match.pd
+++ b/gcc/match.pd
@@ -1997,6 +1997,11 @@ DEFINE_INT_AND_FLOAT_ROUND_FN (RINT)
(simplify
(pointer_plus (pointer_plus:s @0 @1) @3)
(pointer_plus @0 (plus @1 @3)))
+#if GENERIC
+(simplify
+ (pointer_plus (convert:s (pointer_plus:s @0 @1)) @3)
+ (convert:type (pointer_plus @0 (plus @1 @3))))
+#endif
/* Pattern match
tem1 = (long) ptr1;
--
2.34.1