ipa-modref cleanup

Jan Hubicka hubicka@kam.mff.cuni.cz
Tue Nov 2 23:04:20 GMT 2021

> It broke GCC bootstrap:
> https://gcc.gnu.org/pipermail/gcc-regression/2021-November/075676.html
> In file included from ../../src-master/gcc/coretypes.h:474,
>                  from ../../src-master/gcc/expmed.c:26:
> In function ‘poly_uint16 mode_to_bytes(machine_mode)’,
>     inlined from ‘typename if_nonpoly<typename
> T::measurement_type>::type GET_MODE_SIZE(const T&) [with T =
> scalar_int_mode]’ at ../../src-master/gcc/machmode.h:647:24,
>     inlined from ‘rtx_def* emit_store_flag_1(rtx, rtx_code, rtx, rtx,
> machine_mode, int, int, machine_mode)’ at
> ../../src-master/gcc/expmed.c:5723:56:
> ../../src-master/gcc/machmode.h:550:49: warning: ‘*(unsigned
> int*)((char*)&int_mode + offsetof(scalar_int_mode,
> scalar_int_mode::m_mode))’ may be used uninitialized in this function
> [-Wmaybe-uninitialized]
>   550 |           ? mode_size_inline (mode) : mode_size[mode]);
>       |                                                 ^~~~
> ../../src-master/gcc/expmed.c: In function ‘rtx_def*
> emit_store_flag_1(rtx, rtx_code, rtx, rtx, machine_mode, int, int,
> machine_mode)’:
> ../../src-master/gcc/expmed.c:5652:19: note: ‘*(unsigned
> int*)((char*)&int_mode + offsetof(scalar_int_mode,
> scalar_int_mode::m_mode))’ was declared here
>  5652 |   scalar_int_mode int_mode;
>       |                   ^~~~~~~~

I seem to be able to bootstrap normally, so perhaps it is related to
--with-arch=native.  I will try with that config.
However looking at the code
  scalar_int_mode int_mode;
  if (is_int_mode (mode, &int_mode)
      && GET_MODE_BITSIZE (int_mode) == BITS_PER_WORD * 2

the int_mode is indeed set conditionally and it is possible that this
may trigger false positive.  I will however try again that we get same
modref summaries before and after patch.

There is PR103040 that shows wrong code bug in my earlier modref change
I am testinf fix for, but if that is the culprint it should have
reproduced earlier than with this commit.


More information about the Gcc-patches mailing list