Bug 308660

Summary: Regression(302941@main): inline asm in WTF::opaque() needs to be volatile.
Product: WebKit Reporter: Mark Lam <mark.lam>
Component: New BugsAssignee: Mark Lam <mark.lam>
Status: RESOLVED FIXED    
Severity: Normal CC: webkit-bug-importer
Priority: P2 Keywords: InRadar
Version: WebKit Nightly Build   
Hardware: Unspecified   
OS: Unspecified   

Mark Lam
Reported 2026-02-25 12:09:25 PST
Otherwise, compiler optimizations may elide or relocate the asm statement. See https://gcc.gnu.org/onlinedocs/gcc-4.7.2/gcc/Extended-Asm.html: ``` If an asm has output operands, GCC assumes for optimization purposes the instruction has no side effects except to change the output operands. This does not mean instructions with a side effect cannot be used, but you must be careful, because the compiler may eliminate them if the output operands aren't used, or move them out of loops, or replace two with one if they constitute a common subexpression. Also, if your instruction does have a side effect on a variable that otherwise appears not to change, the old value of the variable may be reused later if it happens to be found in a register. You can prevent an asm instruction from being deleted by writing the keyword volatile after the asm. For example: #define get_and_set_priority(new) \ ({ int __old; \ asm volatile ("get_and_set_priority %0, %1" \ : "=g" (__old) : "g" (new)); \ __old; }) ```
Attachments
Mark Lam
Comment 1 2026-02-25 12:09:48 PST
Mark Lam
Comment 2 2026-02-25 12:17:47 PST
EWS
Comment 3 2026-02-25 16:34:31 PST
Committed 308243@main (9f672ca021c2): <https://commits.webkit.org/308243@main> Reviewed commits have been landed. Closing PR #59441 and removing active labels.
Note You need to log in before you can comment on or make changes to this bug.