Files
codeql/cpp/ql/test/library-tests/ir/ir/try_except.c
2025-06-16 15:02:08 +02:00

67 lines
749 B
C

// semmle-extractor-options: --microsoft
void ProbeFunction();
void sink();
void f() {
int x, y = 0;
__try {
ProbeFunction(0);
x = y;
ProbeFunction(0);
}
__except (0) {
sink(x);
}
}
void g() {
int x, y = 0;
__try {
ProbeFunction(0);
x = y;
ProbeFunction(0);
}
__finally {
sink(x);
}
}
void AfxThrowMemoryException();
void h(int b) {
int x = 0;
__try {
if (b) {
AfxThrowMemoryException();
}
}
__except (1) {
sink(x);
}
}
int i();
void j(int b) {
int x = 0;
__try {
int y = i();
}
__except (1) {
sink(x);
}
}
void k(int *b, int *c, int *d) {
int x = 0;
__try {
x = *b;
*c = x;
int y = *d;
}
__except (1) {
sink(x);
}
}