https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110754
--- Comment #4 from Xi Ruoyao <xry111 at gcc dot gnu.org> --- (In reply to Andrew Pinski from comment #2) > (In reply to Xi Ruoyao from comment #1) > > Is this a bug? The standard defines accessing volatile objects as > > side-effects so it's not allowed to merge volatile loads, AFAIU. > > Yes because assume attribute is defined not to have any side effects. > > Confirmed. > > gimplifier produces: > > [[assume (D.2786)]] > { > { > int n.0; > > n.0 = n; > D.2786 = n.0 == 1; > } > } > > And then lowering produces: > _2 = n; > .ASSUME (_Z3bari._assume.0, _2); > > But really it should have passed the address of n rather than the value > since n is volatile here . Alright, I mistakenly believed [[assume(x)]]; is same as if (!x) unreachable();.