CodeQL / Analyze (actions) (push) Canceled after 0s
CodeQL / Analyze (python) (push) Canceled after 0s
pre-commit / pre-commit (push) Canceled after 0s
Multi-Arch CI / setup (push) Canceled after 0s
Publish build_manylinux_x86_64 images / publish_build_manylinux_x86_64 (push) Canceled after 0s
Setup (Multi-Arch) / setup (push) Canceled after 0s
Multi-Arch CI / Linux::${{ fromJSON(needs.setup.outputs.linux_build_config || '{}').build_variant_label || 'skip' }} (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish no_rocm_image_ubi10 image / publish_no_rocm_image_ubi10 (push) Canceled after 0s
Multi-Arch CI / Windows::${{ fromJSON(needs.setup.outputs.windows_build_config || '{}').build_variant_label || 'skip' }} (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Multi-Arch CI / Manifest Diff (push) Canceled after 0s
TheRock Manifest Diff Report / Generate Manifest Diff Report (push) Canceled after 0s
Multi-Arch CI / CI Summary (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04 (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04_ocl_rt images / publish_no_rocm_image_ubuntu24_04_ocl_rt (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_rocgdb (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04_rocgdb images / publish_no_rocm_image_ubuntu24_04_rocgdb (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_ocl_rt (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Unit Tests / Unit Tests :: ubuntu-24.04 (push) Canceled after 0s
Unit Tests / Unit Tests :: windows-2022 (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_media (push) Canceled after 0s
Unit Tests / Unit Tests Summary (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_openmpi (push) Canceled after 0s
112 lines
4.3 KiB
C
112 lines
4.3 KiB
C
// RUN: rm -rf %t && mkdir %t
|
|
// RUN: mkdir -p %t/ctudir2
|
|
// RUN: %clang_cc1 -triple x86_64-pc-linux-gnu \
|
|
// RUN: -emit-pch -o %t/ctudir2/other.c.ast %S/Inputs/other.c
|
|
// RUN: cp %S/Inputs/other.c.externalDefMap.ast-dump.txt %t/ctudir2/externalDefMap.txt
|
|
|
|
// RUN: %clang_analyze_cc1 -triple x86_64-pc-linux-gnu -std=c89 \
|
|
// RUN: -analyzer-checker=core,debug.ExprInspection \
|
|
// RUN: -analyzer-config eagerly-assume=false \
|
|
// RUN: -analyzer-config experimental-enable-naive-ctu-analysis=true \
|
|
// RUN: -analyzer-config ctu-dir=%t/ctudir2 \
|
|
// RUN: -analyzer-config ctu-phase1-inlining=none \
|
|
// RUN: -verify=newctu %s
|
|
|
|
// Simulate the behavior of the previous CTU implementation by inlining all
|
|
// functions during the first phase. This way, the second phase is a noop.
|
|
// RUN: %clang_analyze_cc1 -triple x86_64-pc-linux-gnu -std=c89 \
|
|
// RUN: -analyzer-checker=core,debug.ExprInspection \
|
|
// RUN: -analyzer-config eagerly-assume=false \
|
|
// RUN: -analyzer-config experimental-enable-naive-ctu-analysis=true \
|
|
// RUN: -analyzer-config ctu-dir=%t/ctudir2 \
|
|
// RUN: -analyzer-config ctu-phase1-inlining=all \
|
|
// RUN: -verify=oldctu %s
|
|
|
|
void clang_analyzer_eval(int);
|
|
|
|
// A function that's definition is unknown both for single-tu (stu) and ctu
|
|
// mode.
|
|
int unknown(int);
|
|
void test_unknown() {
|
|
int res = unknown(6);
|
|
clang_analyzer_eval(res == 6); // newctu-warning{{UNKNOWN}}
|
|
// oldctu-warning@-1{{UNKNOWN}}
|
|
}
|
|
|
|
// Test typedef and global variable in function.
|
|
typedef struct {
|
|
int a;
|
|
int b;
|
|
} FooBar;
|
|
extern FooBar fb;
|
|
int f(int);
|
|
void testGlobalVariable() {
|
|
clang_analyzer_eval(f(5) == 1); // newctu-warning{{TRUE}} ctu
|
|
// newctu-warning@-1{{UNKNOWN}} stu
|
|
// oldctu-warning@-2{{TRUE}}
|
|
}
|
|
|
|
// Test enums.
|
|
int enumCheck(void);
|
|
enum A { x,
|
|
y,
|
|
z };
|
|
void testEnum(void) {
|
|
clang_analyzer_eval(x == 0); // newctu-warning{{TRUE}}
|
|
// oldctu-warning@-1{{TRUE}}
|
|
clang_analyzer_eval(enumCheck() == 42); // newctu-warning{{TRUE}} ctu
|
|
// newctu-warning@-1{{UNKNOWN}} stu
|
|
// oldctu-warning@-2{{TRUE}}
|
|
}
|
|
|
|
// Test that asm import does not fail.
|
|
int inlineAsm(void);
|
|
int testInlineAsm(void) {
|
|
return inlineAsm();
|
|
}
|
|
|
|
// Test reporting error in a macro.
|
|
struct S;
|
|
int g(struct S *);
|
|
void testMacro(void) {
|
|
g(0); // newctu-warning@Inputs/other.c:29 {{Access to field 'a' results in a dereference of a null pointer (loaded from variable 'ctx')}}
|
|
// oldctu-warning@Inputs/other.c:29 {{Access to field 'a' results in a dereference of a null pointer (loaded from variable 'ctx')}}
|
|
}
|
|
|
|
// The external function prototype is incomplete.
|
|
// warning:implicit functions are prohibited by c99
|
|
void testImplicit(void) {
|
|
int res = identImplicit(6); // external implicit functions are not inlined
|
|
clang_analyzer_eval(res == 6); // newctu-warning{{TRUE}} ctu
|
|
// newctu-warning@-1{{UNKNOWN}} stu
|
|
// oldctu-warning@-2{{TRUE}}
|
|
// Call something with uninitialized from the same function in which the implicit was called.
|
|
// This is necessary to reproduce a special bug in NoStoreFuncVisitor.
|
|
int uninitialized;
|
|
h(uninitialized); // newctu-warning{{1st function call argument is an uninitialized value}}
|
|
// oldctu-warning@-1{{1st function call argument is an uninitialized value}}
|
|
}
|
|
|
|
// Tests the import of functions that have a struct parameter
|
|
// defined in its prototype.
|
|
struct DataType {
|
|
int a;
|
|
int b;
|
|
};
|
|
int structInProto(struct DataType *d);
|
|
void testStructDefInArgument(void) {
|
|
struct DataType d;
|
|
d.a = 1;
|
|
d.b = 0;
|
|
// Not imported, thus remains unknown both in stu and ctu.
|
|
clang_analyzer_eval(structInProto(&d) == 0); // newctu-warning{{UNKNOWN}}
|
|
// oldctu-warning@-1{{UNKNOWN}}
|
|
// newctu-warning@-2{{import of an external symbol for CTU failed: Failed to import the definition.}}
|
|
// oldctu-warning@-3{{import of an external symbol for CTU failed: Failed to import the definition.}}
|
|
}
|
|
|
|
int switchWithoutCases(int);
|
|
void testSwitchStmtCrash(int x) {
|
|
switchWithoutCases(x);
|
|
}
|