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

2018-04-27 Thread Richard Smith - zygoloid via Phabricator via cfe-commits
rsmith added inline comments. Comment at: test/Analysis/asm.cpp:9 + ref = 1; + __asm__("" : "=r"((int)global)); // don't crash on rvalue output operand + clang_analyzer_eval(global == 1); // expected-warning{{UNKNOWN}} Ugh, do we really need to support this

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

2018-04-27 Thread Artem Dergachev via Phabricator via cfe-commits
NoQ accepted this revision. NoQ added a subscriber: rsmith. NoQ added a comment. Woohoo LGTM. Heads up to @rsmith because we're about to break the CFG again, and also yay we've found another use case for rewriting AST in our CFG. Repository: rC Clang https://reviews.llvm.org/D45416

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

2018-04-25 Thread Aleksei Sidorin via Phabricator via cfe-commits
a.sidorin updated this revision to Diff 143959. a.sidorin added a comment. Add a test for CFG dump; replace static_cast with an initialization. No test failures on check-all were observed. Repository: rC Clang https://reviews.llvm.org/D45416 Files: include/clang/Analysis/CFG.h

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

2018-04-16 Thread Artem Dergachev via Phabricator via cfe-commits
NoQ added a comment. (also we'll need CFG dump tests) Repository: rC Clang https://reviews.llvm.org/D45416 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

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

2018-04-13 Thread Artem Dergachev via Phabricator via cfe-commits
NoQ added a comment. (i'd much rather do the latter) Repository: rC Clang https://reviews.llvm.org/D45416 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

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

2018-04-13 Thread Artem Dergachev via Phabricator via cfe-commits
NoQ accepted this revision. NoQ added a comment. Wow, you actually did that. Ok, now we can decide if we want this to be analyzer-only (with a `CFG::BuildOptions` flag) or get someone else to have a look at that as a global CFG change (i.e. it may potentially affect compiler warnings). Or at

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

2018-04-12 Thread Aleksei Sidorin via Phabricator via cfe-commits
a.sidorin updated this revision to Diff 142226. a.sidorin added a comment. Rewrite the GCCAsmStmt in the CFG. Repository: rC Clang https://reviews.llvm.org/D45416 Files: include/clang/Analysis/CFG.h lib/Analysis/CFG.cpp lib/StaticAnalyzer/Core/ExprEngine.cpp test/Analysis/asm.cpp

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

2018-04-10 Thread Artem Dergachev via Phabricator via cfe-commits
NoQ added a comment. I mean, like, if we try to work with the existing AST then we're stuck with a prvalue expression that represents an lvalue and will be assigned a `Loc` value, which is pretty weird anyway. Getting rid of the ParentMap in favor of providing enough context (eg. in the CFG or

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

2018-04-10 Thread Artem Dergachev via Phabricator via cfe-commits
NoQ added a comment. In https://reviews.llvm.org/D45416#1062901, @a.sidorin wrote: > > 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

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

2018-04-10 Thread Aleksei Sidorin via Phabricator via cfe-commits
a.sidorin added a comment. Maybe we should just remove the condition and leave a FIXME? Repository: rC Clang https://reviews.llvm.org/D45416 ___ cfe-commits mailing list cfe-commits@lists.llvm.org

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

2018-04-10 Thread Aleksei Sidorin via Phabricator via cfe-commits
a.sidorin added a comment. > 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. I

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

2018-04-09 Thread Artem Dergachev via Phabricator via cfe-commits
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() {

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

2018-04-09 Thread George Karpenkov via Phabricator via cfe-commits
george.karpenkov accepted this revision. george.karpenkov added a comment. This revision is now accepted and ready to land. Right, sorry. LGTM, but maybe Artem has something to add as well. I don't have any suggestions, and trying to modifying lifetimes of expressions in environment for the sake

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

2018-04-09 Thread Aleksei Sidorin via Phabricator via cfe-commits
a.sidorin added inline comments. Comment at: lib/StaticAnalyzer/Core/ExprEngine.cpp:3082 +if (X.isUnknown()) { + // The value being casted to rvalue can be garbage-collected after + // the cast is modeled. Try to recover the memory region being casted

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

2018-04-09 Thread George Karpenkov via Phabricator via cfe-commits
george.karpenkov requested changes to this revision. george.karpenkov added inline comments. This revision now requires changes to proceed. Comment at: lib/StaticAnalyzer/Core/ExprEngine.cpp:3082 +if (X.isUnknown()) { + // The value being casted to rvalue can be

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

2018-04-08 Thread Aleksei Sidorin via Phabricator via cfe-commits
a.sidorin created this revision. a.sidorin added reviewers: NoQ, dcoughlin, xazax.hun. Herald added subscribers: cfe-commits, rnkovacs, szepet. Herald added a reviewer: george.karpenkov. Despite the fact that cast expressions return rvalues, GCC still handles such outputs as lvalues when