Clang Project

clang_source_code/test/Analysis/unsupported-types.c
1// RUN: %clang_analyze_cc1 -analyzer-checker=core,debug.ExprInspection -verify %s
2// RUN: %clang_analyze_cc1 -analyzer-checker=core,debug.ExprInspection -triple x86_64-unknown-linux -verify %s
3// RUN: %clang_analyze_cc1 -analyzer-checker=core,debug.ExprInspection -triple powerpc64-linux-gnu -verify %s
4
5#define _Complex_I      (__extension__ 1.0iF)
6
7void clang_analyzer_eval(int);
8
9void complex_float(double _Complex x, double _Complex y) {
10  clang_analyzer_eval(x == y); // expected-warning{{UNKNOWN}}
11  if (x != 1.0 + 3.0 * _Complex_I && y != 1.0 - 4.0 * _Complex_I)
12    return
13  clang_analyzer_eval(x == y); // expected-warning{{UNKNOWN}}
14  clang_analyzer_eval(x + y == 2.0 - 1.0 * _Complex_I); // expected-warning{{UNKNOWN}}
15}
16
17void complex_int(int _Complex x, int _Complex y) {
18  clang_analyzer_eval(x == y); // expected-warning{{UNKNOWN}}
19  if (x != 1.0 + 3.0 * _Complex_I && y != 1.0 - 4.0 * _Complex_I)
20    return
21  clang_analyzer_eval(x == y); // expected-warning{{UNKNOWN}}
22  clang_analyzer_eval(x + y == 2.0 - 1.0 * _Complex_I); // expected-warning{{UNKNOWN}}
23}
24
25void longdouble_float(long double x, long double y) {
26  clang_analyzer_eval(x == y); // expected-warning{{UNKNOWN}}
27  if (x != 0.0L && y != 1.0L)
28    return
29  clang_analyzer_eval(x == y); // expected-warning{{UNKNOWN}}
30  clang_analyzer_eval(x + y == 1.0L); // expected-warning{{UNKNOWN}}
31}
32