[AMDGPU][AsmParser][NFC] Get rid of custom default operand handlers.
[llvm-project.git] / clang / test / Analysis / diagnostics / sarif-multi-diagnostic-test.c
blob61d19817407e27316a4678b380e053b188577c27
1 // RUN: %clang_analyze_cc1 -analyzer-checker=core,alpha.security.taint,debug.TaintTest,unix.Malloc %s -verify -analyzer-output=sarif -o - | %normalize_sarif | diff -U1 -b %S/Inputs/expected-sarif/sarif-multi-diagnostic-test.c.sarif -
2 #include "../Inputs/system-header-simulator.h"
3 #include "../Inputs/system-header-simulator-for-malloc.h"
4 #define ERR -1
6 int atoi(const char *nptr);
8 void f(void) {
9 char s[80];
10 scanf("%s", s);
11 int d = atoi(s); // expected-warning {{tainted}}
14 void g(void) {
15 void (*fp)(int);
16 fp(12); // expected-warning {{Called function pointer is an uninitialized pointer value}}
19 int h(int i) {
20 if (i == 0)
21 return 1 / i; // expected-warning {{Division by zero}}
22 return 0;
25 int leak(int i) {
26 void *mem = malloc(8);
27 if (i < 4)
28 return ERR; // expected-warning {{Potential leak of memory pointed to by 'mem'}}
29 free(mem);
30 return 0;
33 int unicode(void) {
34 int løçål = 0;
35 /* ☃ */ return 1 / løçål; // expected-warning {{Division by zero}}
38 int main(void) {
39 f();
40 g();
41 h(0);
42 leak(0);
43 unicode();
44 return 0;