From fa6092d2cdc654d4b2e018929c0dbe13fbd4ea69 Mon Sep 17 00:00:00 2001 From: Rainer Orth Date: Wed, 3 Mar 2021 16:01:50 +0100 Subject: sparcv9: Disable -Wuninitialized warnings breaking bootstrap [PR92002] MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sparcv9 bootstrap has been broken for 1 1/2 years now by spurious -Wuninitialized warnings: In function ‘wide_int wi::max_value(unsigned int, signop)’, inlined from ‘wide_int wi::max_value(unsigned int, signop)’ at /vol/gcc/src/hg/master/local/gcc/wide-int.cc:330:1: /vol/gcc/src/hg/master/local/gcc/wide-int.cc:335:31: error: ‘.generic_wide_int::.wide_int_storage::val[1]’ may be used uninitialized [-Werror=maybe-uninitialized] 335 | return shwi (-1, precision); | ^ [...] In function ‘wide_int get_nonzero_bits(const_tree)’, inlined from ‘wide_int get_nonzero_bits(const_tree)’ at /vol/gcc/src/hg/master/local/gcc/tree-ssanames.c:531:1: /vol/gcc/src/hg/master/local/gcc/tree-ssanames.c:544:67: error: ‘.generic_wide_int::.wide_int_storage::val[1]’ may be used uninitialized [-Werror=maybe-uninitialized] 544 | | (HOST_WIDE_INT) pi->misalign, precision); | ^ [...] Before we ship yet another release with this issue, I suggest to at least include a workaround of demoting them to warnings. Tested on sparcv9-sun-solaris2.11. 2021-03-03 Rainer Orth gcc: PR bootstrap/92002 * config/sparc/t-sparc (tree-ssanames.o-warn): Don't error for -Wuninitialized, -Wmaybe-uninitialized. (wide-int.o-warn): Likewise. --- gcc/config/sparc/t-sparc | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'gcc/config/sparc') diff --git a/gcc/config/sparc/t-sparc b/gcc/config/sparc/t-sparc index de99ce7..64906e9 100644 --- a/gcc/config/sparc/t-sparc +++ b/gcc/config/sparc/t-sparc @@ -27,3 +27,7 @@ sparc-c.o: $(srcdir)/config/sparc/sparc-c.c sparc-d.o: $(srcdir)/config/sparc/sparc-d.c $(COMPILE) $< $(POSTCOMPILE) + +# Hack around PR bootstrap/92002. +tree-ssanames.o-warn += -Wno-error=uninitialized -Wno-error=maybe-uninitialized +wide-int.o-warn += -Wno-error=uninitialized -Wno-error=maybe-uninitialized -- cgit v1.1 From da7343a6f48c6813a29640fec744b0a236b6540f Mon Sep 17 00:00:00 2001 From: Eric Botcazou Date: Wed, 10 Mar 2021 12:02:14 +0100 Subject: Fix miscompilation of Ada runtime on 64-bit SPARC Returning a REGMODE_NATURAL_SIZE of 4 for DFmode in 64-bit mode is just asking for trouble because sub-word SUBREGs are always treated differently than the others, in particular by the register allocator. gcc/ * config/sparc/sparc.c (sparc_regmode_natural_size): Return 4 for float and vector integer modes only if the mode is not larger. --- gcc/config/sparc/sparc.c | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) (limited to 'gcc/config/sparc') diff --git a/gcc/config/sparc/sparc.c b/gcc/config/sparc/sparc.c index f355793..f150417 100644 --- a/gcc/config/sparc/sparc.c +++ b/gcc/config/sparc/sparc.c @@ -13585,23 +13585,18 @@ sparc_expand_vcond (machine_mode mode, rtx *operands, int ccode, int fcode) emit_insn (gen_rtx_SET (operands[0], bshuf)); } -/* On sparc, any mode which naturally allocates into the float +/* On the SPARC, any mode which naturally allocates into the single float registers should return 4 here. */ unsigned int sparc_regmode_natural_size (machine_mode mode) { - int size = UNITS_PER_WORD; + const enum mode_class cl = GET_MODE_CLASS (mode); - if (TARGET_ARCH64) - { - enum mode_class mclass = GET_MODE_CLASS (mode); - - if (mclass == MODE_FLOAT || mclass == MODE_VECTOR_INT) - size = 4; - } + if ((cl == MODE_FLOAT || cl == MODE_VECTOR_INT) && GET_MODE_SIZE (mode) <= 4) + return 4; - return size; + return UNITS_PER_WORD; } /* Implement TARGET_HARD_REGNO_NREGS. -- cgit v1.1