https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101562
--- Comment #10 from CVS Commits <cvs-commit at gcc dot gnu.org> --- The releases/gcc-10 branch has been updated by Jakub Jelinek <ja...@gcc.gnu.org>: https://gcc.gnu.org/g:6cb2b5581d2ca5b4175dc2cf4f32e4251a314eda commit r10-10638-g6cb2b5581d2ca5b4175dc2cf4f32e4251a314eda Author: Jakub Jelinek <ja...@redhat.com> Date: Fri Jul 23 19:55:16 2021 +0200 expmed: Fix store_integral_bit_field [PR101562] Our documentation says that paradoxical subregs shouldn't appear in strict_low_part: '(strict_low_part (subreg:M (reg:N R) 0))' This expression code is used in only one context: as the destination operand of a 'set' expression. In addition, the operand of this expression must be a non-paradoxical 'subreg' expression. but on the testcase below that triggers UB at runtime store_integral_bit_field emits exactly that. The following patch fixes it by ensuring the requirement is satisfied. 2021-07-23 Jakub Jelinek <ja...@redhat.com> PR rtl-optimization/101562 * expmed.c (store_integral_bit_field): Only use movstrict_optab if the operand isn't paradoxical. * gcc.c-torture/compile/pr101562.c: New test. (cherry picked from commit 8408d34570c9fe9f3d22a25a76df2a4c64f08477)