mirror of
https://github.com/llvm/llvm-project.git
synced 2025-04-28 00:36:06 +00:00

Despite the fact that cast expressions return rvalues, GCC still handles such outputs as lvalues when compiling inline assembler. In this commit, we are treating it by removing LValueToRValue casts inside GCCAsmStmt outputs. Differential Revision: https://reviews.llvm.org/D45416 llvm-svn: 344864
13 lines
423 B
C++
13 lines
423 B
C++
// 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)(global)))); // don't crash on rvalue output operand
|
|
clang_analyzer_eval(global == 1); // expected-warning{{UNKNOWN}}
|
|
clang_analyzer_eval(ref == 1); // expected-warning{{UNKNOWN}}
|
|
}
|