Regenerate config/avr/avr.opt.urls
[official-gcc.git] / gcc / testsuite / c-c++-common / tsan / free_race2.c
blob89d12c3175b4c22f075f272e62f4ca8dea25f96c
1 /* { dg-shouldfail "tsan" } */
2 /* { dg-additional-options "-fno-ipa-modref" } */
4 #include <stdlib.h>
6 void __attribute__((noinline)) foo(int *mem) {
7 free(mem);
10 void __attribute__((noinline)) bar(int *mem) {
11 mem[0] = 42;
14 int main() {
15 int *mem = (int*)malloc(100);
16 foo(mem);
17 bar(mem);
18 return 0;
21 /* { dg-output "WARNING: ThreadSanitizer: heap-use-after-free.*(\n|\r\n|\r)" } */
22 /* { dg-output " Write of size 4.* by main thread:(\n|\r\n|\r)" } */
23 /* { dg-output " #0 bar.*" } */
24 /* { dg-output " #1 main .*" } */
25 /* { dg-output " Previous write of size 8 at .* by main thread:(\n|\r\n|\r)" } */
26 /* { dg-output " #0 free .*" } */
27 /* { dg-output " #\(1|2\) foo.*(\n|\r\n|\r)" } */
28 /* { dg-output " #\(2|3\) main .*" } */