Debian Codegraph @

clang/test/Analysis/Issue56873.cpp

raw
1 // RUN: %clang_analyze_cc1 -analyzer-checker=debug.ExprInspection -verify %s
2
3 void clang_analyzer_warnIfReached();
4
5 struct S {
6 };
7
8 void Issue56873_1() {
9 int n;
10
11 // This line used to crash
12 S *arr = new S[n];
13
14 clang_analyzer_warnIfReached(); // expected-warning{{REACHABLE}}
15 }
16
17 void Issue56873_2() {
18 int n;
19
20 // This line used to crash
21 int *arr = new int[n];
22
23 clang_analyzer_warnIfReached(); // expected-warning{{REACHABLE}}
24 }