https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71372
Richard Biener <rguenth at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Priority|P3 |P2 --- Comment #4 from Richard Biener <rguenth at gcc dot gnu.org> --- So pre gimplification we have (gdb) p debug_generic_expr (0x7ffff69fcbe0) *FLASH (gdb) p ((tree)0x7ffff69fcbe0)->base.volatile_flag $5 = 0 thus somehow the INDIRECT_REF misses the TREE_THIS_VOLATILE flag. So it is cp_fold folding <indirect_ref 0x7ffff69fc960 type <integer_type 0x7ffff69ee7e0 short unsigned int volatile unsigned HI size <integer_cst 0x7ffff68a8018 constant 16> unit size <integer_cst 0x7ffff68a8030 constant 2> align 16 symtab 0 alias set -1 canonical type 0x7ffff69ee7e0 precision 16 min <integer_cst 0x7ffff68a8048 0> max <integer_cst 0x7ffff68a8000 65535> pointer_to_this <pointer_type 0x7ffff69ee888>> side-effects volatile ^^^^^^^^^^^^^^^^^^^^^^ via unary: loc = EXPR_LOCATION (x); op0 = cp_fold_maybe_rvalue (TREE_OPERAND (x, 0), rval_ops); if (op0 != TREE_OPERAND (x, 0)) { if (op0 == error_mark_node) x = error_mark_node; else x = fold_build1_loc (loc, code, TREE_TYPE (x), op0); ^^^^^^^^^^^ but forgetting to re-apply TREE_THIS_VOLATILE. This probably seriously breaks volatile support.