On Mon, Jan 04, 2021 at 01:51:59PM -0700, Jeff Law via Gcc-patches wrote:
> > Sorry, I forgot to include the ChangeLog:
> >
> >     gcc/ChangeLog:
> >     
> >     2020-12-31  Xi Ruoyao <xry...@mengyan1223.wang>
> >     
> >             PR target/98491
> >             * config/mips/mips.c (mips_symbol_insns): Do not use
> >               MSA_SUPPORTED_MODE_P if mode is MAX_MACHINE_MODE.
> So I absolutely agree the current code is wrong as it does an out of
> bounds array access.
> 
> 
> Would it be better to instead to change MSA_SUPPORTED_MODE_P to evaluate
> to zero if MODE is MAX_MACHINE_MODE?  That would protect all the uses of
> MSA_SUPPORTED_MODE_P.    Something like this perhaps?

But MAX_MACHINE_MODE is the one past last valid mode, I'm not aware of
any target that would protect all macros that deal with modes that way.

So, perhaps best would be stop using the MAX_MACHINE_MODE as magic value
for that function and instead use say VOIDmode that shouldn't normally
appear either?

But I don't really see anything wrong on the mips_symbol_insns above
change either.

        Jakub

Reply via email to