[cfe-commits] r166655 - in /cfe/trunk: include/clang/Basic/DiagnosticSemaKinds.td include/clang/Basic/TargetInfo.h lib/Basic/Targets.cpp lib/Sema/SemaStmtAsm.cpp test/Misc/warning-flags.c

Eric Christopher echristo at gmail.com
Thu Oct 25 10:57:40 PDT 2012


>> That's basically what I'm getting at, yes. Why I reverted the patch was because it needs to be thought through a bit more before I and I assume others are happy with it. :)
>
> Sure.  FWIW, I think your original warning should be a lot simpler to make satisfactory than the inadequate-constraint one that your later example's about.
>
> Regardless, you'll need a warning group, and you probably ought to make two — one for this specific warning (-Wasm-operand-widths?), and an umbrella group for all warnings about asm statements (-Wasm?)
>

So when I came up with this originally the plan was to warn on
particularly fatal types of assembly mismatches with constraints
and/or modifiers. In the case of x86, for example, I'd want to see a
warning (I think) on:

uint32_t a;
asm("mov %0, %1" : "=r" (a) : "i" (0xffffffffff));

(yes, it's contrived) but basically if there are mismatches between
the size of the operand being stored/copied/etc and the size of the
destination. Truncation only since I'm not quite sure how I'd like to
handle widening. Probably too many false positives on the warnings
since people could easily be taking advantage of zero/sign extension
on some instructions.

-eric




More information about the cfe-commits mailing list