diff mbox series

[avr,applied] ad PR84211: Fix build fallout from PR84211 on some hosts

Message ID 4069da97-f027-4935-b974-148802e72280@gjlay.de
State New
Headers show
Series [avr,applied] ad PR84211: Fix build fallout from PR84211 on some hosts | expand

Commit Message

Georg-Johann Lay Nov. 19, 2024, 2:25 p.m. UTC
Am 19.11.24 um 14:48 schrieb Georg-Johann Lay:
> Am 19.11.24 um 13:31 schrieb Andreas Schwab:
>> ../../gcc/config/avr/avr-passes.cc: In member function ‘void 
>> {anonymous}::memento_t::apply_insn1(rtx_insn*, bool)’:
>> ../../gcc/config/avr/avr-passes.cc:2119:9: error: no match for 
>> ‘operator&=’ (operand types are ‘{anonymous}::gprmask_t’ {aka 
>> ‘unsigned int’} and ‘HARD_REG_SET’)
>>   2119 |   known &= ~rset;
>>        |   ~~~~~~^~~~~~~~
>> In file included from ../../gcc/coretypes.h:513,
>>                   from ../../gcc/config/avr/avr-passes.cc:27:
>> ../../gcc/dumpfile.h:240:1: note: candidate: ‘dump_flags_t& 
>> operator&=(dump_flags_t&, dump_flags_t)’
>>    240 | operator&= (dump_flags_t &lhs, dump_flags_t rhs)
>>        | ^~~~~~~~
>> ../../gcc/dumpfile.h:240:45: note:   no known conversion for argument 
>> 2 from ‘HARD_REG_SET’ to ‘dump_flags_t’ {aka ‘dump_flag’}
>>    240 | operator&= (dump_flags_t &lhs, dump_flags_t rhs)
>>        |                                ~~~~~~~~~~~~~^~~
>> make[2]: *** [../../gcc/config/avr/t-avr:65: avr-passes.o] Error 1
> 
> Thank you.
> 
> Presumably that's on a host (i386?) where HARD_REG_SET is not a scalar
> but an array of HARD_REG_ELT_TYPEs?
> 
> Does it build with the following patch that should fix it:
> 
> diff --git a/gcc/config/avr/avr-passes.cc b/gcc/config/avr/avr-passes.cc
> index 2b67f9fa32c..3d55cf885c2 100644
> --- a/gcc/config/avr/avr-passes.cc
> +++ b/gcc/config/avr/avr-passes.cc
> @@ -2116,7 +2116,7 @@ memento_t::apply_insn1 (rtx_insn *insn, bool unused)
> 
>     HARD_REG_SET rset;
>     find_all_hard_reg_sets (insn, &rset, true /* implicit */);
> -  known &= ~rset;
> +  (*this) &= ~rset;
> 
>     rtx set = single_set (insn);
>     rtx dest;
> 
> Johann

...I went ahead and applied it preemptively because HARD_REG_SET should
be applied to memento_t, not to memento_t.known.

Thank you again.

Applied as https://gcc.gnu.org/r15-5460

Johann

--

     AVR: ad target/84211 - Fix a build failure on some hosts.

             This fixes a build failure on hosts where HARD_REG_SET is 
not a scalar.
             The issue was introduced with the patch for PR84211 in 
r15-5415.
             PR target/84211
     gcc/
             * config/avr/avr-passes.cc (memento_t::apply_insn1): Don't
             use operator &= on memento_t.known but on memento_t itself.
diff mbox series

Patch

diff --git a/gcc/config/avr/avr-passes.cc b/gcc/config/avr/avr-passes.cc
index 2b67f9fa32c..3d55cf885c2 100644
--- a/gcc/config/avr/avr-passes.cc
+++ b/gcc/config/avr/avr-passes.cc
@@ -2116,7 +2116,7 @@  memento_t::apply_insn1 (rtx_insn *insn, bool unused)

    HARD_REG_SET rset;
    find_all_hard_reg_sets (insn, &rset, true /* implicit */);
-  known &= ~rset;
+  (*this) &= ~rset;

    rtx set = single_set (insn);
    rtx dest;