[Bug middle-end/111818] [11 Regression] ICE with __builtin_memcpy with volatile and constants

2023-12-15 Thread rguenth at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111818

Richard Biener  changed:

   What|Removed |Added

  Known to fail||11.4.0
 Resolution|--- |FIXED
 Status|ASSIGNED|RESOLVED
  Known to work||11.4.1

--- Comment #8 from Richard Biener  ---
Fixed.

[Bug middle-end/111818] [11 Regression] ICE with __builtin_memcpy with volatile and constants

2023-12-15 Thread cvs-commit at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111818

--- Comment #7 from GCC Commits  ---
The releases/gcc-11 branch has been updated by Richard Biener
:

https://gcc.gnu.org/g:45c296f2d81f6259e268e07707b4aa87dffba20a

commit r11-11142-g45c296f2d81f6259e268e07707b4aa87dffba20a
Author: Richard Biener 
Date:   Mon Oct 16 12:50:46 2023 +0200

middle-end/111818 - failed DECL_NOT_GIMPLE_REG_P setting of volatile

The following addresses a missed DECL_NOT_GIMPLE_REG_P setting of
a volatile declared parameter which causes inlining to substitute
a constant parameter into a context where its address is required.

The main issue is in update_address_taken which clears
DECL_NOT_GIMPLE_REG_P from the parameter but fails to rewrite it
because is_gimple_reg returns false for volatiles.  The following
changes maybe_optimize_var to make the 1:1 correspondence between
clearing DECL_NOT_GIMPLE_REG_P of a register typed decl and
actually rewriting it to SSA.

PR middle-end/111818
* tree-ssa.c (maybe_optimize_var): When clearing
DECL_NOT_GIMPLE_REG_P always rewrite into SSA.

* gcc.dg/torture/pr111818.c: New testcase.

(cherry picked from commit ce55521bcd149fdc431f1d78e706b66d470210ae)