https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110516
ibuclaw at gcc dot gnu.org changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |ibuclaw at gcc dot gnu.org --- Comment #1 from ibuclaw at gcc dot gnu.org --- (In reply to Witold Baryluk from comment #0) > gcc 12.2.0 (from Debian stable) and gcc trunk 14.0.0 (in godbolt) tested. > > core.volatile.volatileLoad simply does not work. > > 1) It merges loads. > 2) It removes unused loads at -O1 and higher. > > Example: > > void actualRun(ubyte* ptr1) { > import core.volatile : volatileLoad; > volatileLoad(ptr1); > volatileLoad(ptr1); > volatileLoad(ptr1); > volatileLoad(ptr1); > } Actually, doesn't seem to be doing either 1 or 2, it looks like the statement is just dropped altogether as no obvious side-effect was picked up from the expression to which the intrinsic was expanded into. https://d.godbolt.org/z/361x4vKfn