https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91351
Jakub Jelinek <jakub at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |jakub at gcc dot gnu.org --- Comment #12 from Jakub Jelinek <jakub at gcc dot gnu.org> --- Created attachment 46774 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=46774&action=edit gcc10-pr91351.patch Actually, I believe it is incorrect to change unsigned_type_for, it is used in lots of places and in many of them all we want is just some unsigned type which the enumeral type can very well be. In the code that reassoc range test opt as well as fold-const range test opt uses we use the range_check_type function which gives the right type but it can return NULL_TREE if the type is weird (some Ada integral types?) and optimization shouldn't be performed. So, this patch uses that function and punts where we can if it would return NULL.