[PATCH] D45416: [analyzer] ExprEngine: model GCC inline asm rvalue cast outputs

Artem Dergachev via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Apr 9 14:40:21 PDT 2018


NoQ accepted this revision.
NoQ added a comment.

Thanks!

Eww. Weird AST.

I wonder how this should work:

  // RUN: %clang_analyze_cc1 -analyzer-checker debug.ExprInspection -fheinous-gnu-extensions -w %s -verify
  
  int clang_analyzer_eval(int);
  
  int global;
  void testRValueOutput() {
    int &ref = global;
    ref = 1;
    __asm__("" : "=r"((int)ref));
    clang_analyzer_eval(ref == 1); // currently says UNKNOWN
    clang_analyzer_eval(global == 1); // currently says TRUE
  }

The ultimate solution would probably be to add a fake cloned asm statement to the CFG (instead of the real asm statement) that would point to the correct output child-expression(s) that are untouched themselves but simply have their noop casts removed.

Or we could try


Repository:
  rC Clang

https://reviews.llvm.org/D45416





More information about the cfe-commits mailing list