public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH] PR91195: fix -Wmaybe-uninitialized warning for conditional store optimization
@ 2019-07-23  5:52 JiangNing OS
  2019-07-23 16:31 ` Martin Sebor
                   ` (2 more replies)
  0 siblings, 3 replies; 21+ messages in thread
From: JiangNing OS @ 2019-07-23  5:52 UTC (permalink / raw)
  To: gcc-patches

This patch is to fix PR91195. Is it OK for trunk?

diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 711a31ea597..4db36644160 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,9 @@
+2019-07-22  Jiangning Liu  <jiangning.liu@amperecomputing.com>
+
+	PR middle-end/91195
+	* tree-ssa-phiopt.c (cond_store_replacement): Work around
+	-Wmaybe-uninitialized warning.
+
 2019-07-22  Stafford Horne  <shorne@gmail.com>
 
 	* config/or1k/or1k.c (or1k_expand_compare): Check for int before
diff --git a/gcc/tree-ssa-phiopt.c b/gcc/tree-ssa-phiopt.c
index b64bde695f4..7a86007d087 100644
--- a/gcc/tree-ssa-phiopt.c
+++ b/gcc/tree-ssa-phiopt.c
@@ -2240,6 +2240,14 @@ cond_store_replacement (basic_block middle_bb, basic_block join_bb,
       tree base = get_base_address (lhs);
       if (!auto_var_p (base) || TREE_ADDRESSABLE (base))
 	return false;
+
+      /* The transformation below will inherently introduce a memory load,
+	 for which LHS may not be initialized yet if it is not in NOTRAP,
+	 so a -Wmaybe-uninitialized warning message could be triggered.
+	 Since it's a bit hard to have a very accurate uninitialization
+	 analysis to memory reference, we disable the warning here to avoid
+	 confusion.  */
+      TREE_NO_WARNING (lhs) = 1;
     }
 
   /* Now we've checked the constraints, so do the transformation:

Thanks,
-Jiangning

^ permalink raw reply	[flat|nested] 21+ messages in thread

end of thread, other threads:[~2019-11-20  2:27 UTC | newest]

Thread overview: 21+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-07-23  5:52 [PATCH] PR91195: fix -Wmaybe-uninitialized warning for conditional store optimization JiangNing OS
2019-07-23 16:31 ` Martin Sebor
2019-07-24 15:28   ` Jeff Law
2019-07-24 17:00     ` Martin Sebor
2019-07-24 17:23       ` Jeff Law
2019-07-24 18:09         ` Martin Sebor
2019-07-25  6:27           ` JiangNing OS
2019-07-25 19:09             ` Martin Sebor
2019-07-26  5:07           ` Jeff Law
2019-07-29 16:10           ` Jakub Jelinek
2019-07-30  8:35             ` Richard Biener
2019-07-30  8:36               ` Jakub Jelinek
2019-07-30  8:49                 ` Richard Biener
2019-07-30 14:51                   ` Martin Sebor
2019-08-07 22:17                     ` Jeff Law
2019-09-03 20:22           ` Jeff Law
2019-07-24 16:00 ` Jeff Law
2019-07-29 16:03 ` Jakub Jelinek
2019-09-03 20:27   ` Jeff Law
2019-11-20  0:14     ` Jakub Jelinek
2019-11-20  2:33       ` Jeff Law

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).