xref: /llvm-project/compiler-rt/test/asan/TestCases/frexpl_interceptor.cpp (revision 5888a47914f44ffaf102fcb7afd3500706fe753f)
1 // RUN: %clangxx_asan -O0 %s -o %t && not %run %t 2>&1 | FileCheck %s
2 
3 // Test the frexpl() interceptor.
4 
5 // FIXME: MinGW-w64 implements `frexpl()` as a static import, so the dynamic
6 // interceptor seems to not work.
7 // XFAIL: target={{.*-windows-gnu}}
8 
9 #include <math.h>
10 #include <stdio.h>
11 #include <stdlib.h>
main()12 int main() {
13   long double x = 3.14;
14   int *exp = (int *)malloc(sizeof(int));
15   free(exp);
16   double y = frexpl(x, exp);
17   // CHECK: use-after-free
18   // CHECK: SUMMARY
19   return 0;
20 }
21