forked from llvm/llvm-project
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[analyzer] Fix stores through label locations (llvm#89265)
Interestingly, this case crashed from the very beginning of the project, at least starting by clang-3. As a "fix" I just do the same thing as we do for concrete integers. It might not be the best we could do, but arguably, it's still better than crashing. Fixes llvm#89185
- Loading branch information
Showing
3 changed files
with
20 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
// RUN: %clang_analyze_cc1 -analyzer-checker=core,debug.ExprInspection -verify %s | ||
|
||
void clang_analyzer_dump(char); | ||
void clang_analyzer_dump_ptr(char*); | ||
|
||
// https://github.com/llvm/llvm-project/issues/89185 | ||
void binding_to_label_loc() { | ||
char *b = &&MyLabel; | ||
MyLabel: | ||
*b = 0; // no-crash | ||
clang_analyzer_dump_ptr(b); // expected-warning {{&&MyLabel}} | ||
clang_analyzer_dump(*b); // expected-warning {{Unknown}} | ||
// FIXME: We should never reach here, as storing to a label is invalid. | ||
} |