On 01/31/2017 05:47 PM, Jeff Law wrote:
> On 01/30/2017 06:32 AM, Martin Liška wrote:
>> On 01/30/2017 12:27 PM, Martin Liška wrote:
>>> Hi.
>>>
>>> Following patch simply fixes issues reported by -Wmaybe-unitialized. That 
>>> enables PGO bootstrap
>>> on a s390x machine.
>>>
>>> Ready to be installed?
>>> Martin
>>>
>> There's second version that adds one more hunk for s390 target.
>>
>> Martin
>>
>>
>> 0001-Fix-PGO-bootstrap-on-x390x-PR-bootstrap-78985-v2.patch
>>
>>
>> From 598d0a59b91070211b09056195bc0f971bc57ae1 Mon Sep 17 00:00:00 2001
>> From: marxin <mli...@suse.cz>
>> Date: Mon, 30 Jan 2017 11:09:29 +0100
>> Subject: [PATCH] Fix PGO bootstrap on x390x (PR bootstrap/78985).
>>
>> gcc/ChangeLog:
>>
>> 2017-01-30  Martin Liska  <mli...@suse.cz>
>>
>>     PR bootstrap/78985
>>     * config/s390/s390.c (s390_gimplify_va_arg): Initialize local
>>     variable to NULL.
>>     (print_operand_address): Initialize a struct to zero.
> Presumably the issue with print_operand_address is that there are paths where 
> s390_decompose_address can return without initializing AD/OUT. But AFAICT 
> those are invalid addresses that presumably shouldn't be showing up in 
> print_operand_address.
> 
> Can you add an assert in print_operand_address to ensure decomposition never 
> returns false?

Like done in v2 of the patch?

If so, I'll commit that.

Martin

> 
> OK with that addition.
> 
> jeff
> 

>From 2896518e33878106ee5a6d4766ec80b0b94ad378 Mon Sep 17 00:00:00 2001
From: marxin <mli...@suse.cz>
Date: Mon, 30 Jan 2017 11:09:29 +0100
Subject: [PATCH] Fix PGO bootstrap on x390x (PR bootstrap/78985).

gcc/ChangeLog:

2017-01-30  Martin Liska  <mli...@suse.cz>

	PR bootstrap/78985
	* config/s390/s390.c (s390_gimplify_va_arg): Initialize local
	variable to NULL.
	(print_operand_address): Initialize a struct to zero. Add assert
	that s390_decompose_address never returns false;
---
 gcc/config/s390/s390.c | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/gcc/config/s390/s390.c b/gcc/config/s390/s390.c
index 93377cdf7c8..30a06cf9d94 100644
--- a/gcc/config/s390/s390.c
+++ b/gcc/config/s390/s390.c
@@ -7347,6 +7347,7 @@ void
 print_operand_address (FILE *file, rtx addr)
 {
   struct s390_address ad;
+  memset (&ad, 0, sizeof (s390_address));
 
   if (s390_loadrelative_operand_p (addr, NULL, NULL))
     {
@@ -7360,8 +7361,10 @@ print_operand_address (FILE *file, rtx addr)
       return;
     }
 
-  if (!s390_decompose_address (addr, &ad)
-      || (ad.base && !REGNO_OK_FOR_BASE_P (REGNO (ad.base)))
+  bool r = s390_decompose_address (addr, &ad);
+  gcc_assert (r);
+
+  if ((ad.base && !REGNO_OK_FOR_BASE_P (REGNO (ad.base)))
       || (ad.indx && !REGNO_OK_FOR_INDEX_P (REGNO (ad.indx))))
     output_operand_lossage ("cannot decompose address");
 
@@ -12195,7 +12198,7 @@ s390_gimplify_va_arg (tree valist, tree type, gimple_seq *pre_p,
   tree f_gpr, f_fpr, f_ovf, f_sav;
   tree gpr, fpr, ovf, sav, reg, t, u;
   int indirect_p, size, n_reg, sav_ofs, sav_scale, max_reg;
-  tree lab_false, lab_over;
+  tree lab_false, lab_over = NULL_TREE;
   tree addr = create_tmp_var (ptr_type_node, "addr");
   bool left_align_p; /* How a value < UNITS_PER_LONG is aligned within
 			a stack slot.  */
-- 
2.11.0

Reply via email to