https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95157
Harald van Dijk <harald at gigawatt dot nl> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |harald at gigawatt dot nl --- Comment #1 from Harald van Dijk <harald at gigawatt dot nl> --- For your test case, this seems like a bug in clang to me. The idea of volatile is that the variable might change in ways the compiler cannot tell. The compiler must read insn twice (assuming the first insn < 0 is true) and must not assume the second read has no side effects or produces the same value as the first read. If the two reads of insn can produce different values, it is possible for insn < 0 && insn > 3 to be true. However, if volatile is removed, the warning is correct, and GCC does not warn in that case either.