On 12/12/19 3:35 PM, Jan Hubicka wrote:
Hi,
this rather nasty bug makes value and mask to be exchanged during
streaming.  This makes us to sometimes set bogus pointer alignments
and causes misoptimization of Firefox when built with GCC 9.

Hi.

I've just prepare and tested backport for both GCC 8 and 9 branches.
I'm going to install the patches.

@Honza: Can you please next time create a PR? It's the best tracker
for release branches we have.

Thanks,
Martin


Comitted as obvious.  I will backport it to release branches soon - it
is quite dangerous bug.

Honza

        * ipa-prop.c (read_ipcp_transformation_info): Fix undefined ordering
        of execution of function call parameters.
Index: ipa-prop.c
===================================================================
--- ipa-prop.c  (revision 278815)
+++ ipa-prop.c  (working copy)
@@ -4715,9 +4715,10 @@ read_ipcp_transformation_info (lto_input
          bool known = bp_unpack_value (&bp, 1);
          if (known)
            {
+             const widest_int value = streamer_read_widest_int (ib);
+             const widest_int mask = streamer_read_widest_int (ib);
              ipa_bits *bits
-               = ipa_get_ipa_bits_for_value (streamer_read_widest_int (ib),
-                                             streamer_read_widest_int (ib));
+               = ipa_get_ipa_bits_for_value (value, mask);
              (*ts->bits)[i] = bits;
            }
        }


>From cf37f46be9ef7cebf3a4a277adba5d0ab641ff86 Mon Sep 17 00:00:00 2001
From: hubicka <hubicka@138bc75d-0d04-0410-961f-82ee72b054a4>
Date: Thu, 12 Dec 2019 14:32:48 +0000
Subject: [PATCH] Backport r279306

gcc/ChangeLog:

2019-12-12  Jan Hubicka  <hubi...@ucw.cz>

	* ipa-prop.c (read_ipcp_transformation_info): Fix undefined ordering
	of execution of function call parameters.
---
 gcc/ipa-prop.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/gcc/ipa-prop.c b/gcc/ipa-prop.c
index 848180aa441..40edee7951c 100644
--- a/gcc/ipa-prop.c
+++ b/gcc/ipa-prop.c
@@ -4715,9 +4715,10 @@ read_ipcp_transformation_info (lto_input_block *ib, cgraph_node *node,
 	  bool known = bp_unpack_value (&bp, 1);
 	  if (known)
 	    {
+	      const widest_int value = streamer_read_widest_int (ib);
+	      const widest_int mask = streamer_read_widest_int (ib);
 	      ipa_bits *bits
-		= ipa_get_ipa_bits_for_value (streamer_read_widest_int (ib),
-					      streamer_read_widest_int (ib));
+		= ipa_get_ipa_bits_for_value (value, mask);
 	      (*ts->bits)[i] = bits;
 	    }
 	}
-- 
2.24.1

Reply via email to