Debian Codegraph @

gcc/testsuite/c-c++-common/tm/malloc.c

raw
1 /* { dg-do compile } */
2 /* { dg-options "-fgnu-tm -fdump-tree-tmmark" } */
3 /* { dg-skip-if "requires hosted libstdc++ for stdlib malloc" { ! hostedlib } } */
4
5 #include <stdlib.h>
6
7 char *z;
8
9 void foobar(void)
10 {
11 char *p, *q;
12 __transaction_atomic {
13 p = (char *)malloc(123);
14 q = (char *)calloc(555,1);
15 free(q);
16 free(p);
17 }
18 z = (char *)malloc (666);
19 }
20
21 /* { dg-final { scan-tree-dump-times " malloc .666" 1 "tmmark" { target { ! { *-*-solaris2* && c++ } } } } } */
22 /* Solaris 2 headers are C++-aware and declare std::malloc. */
23 /* { dg-final { scan-tree-dump-times " std::malloc .666" 1 "tmmark" { target { *-*-solaris2* && c++ } } } } */
24 /* { dg-final { scan-tree-dump-times "__builtin__ITM_malloc" 1 "tmmark" } } */
25 /* { dg-final { scan-tree-dump-times "__builtin__ITM_calloc" 1 "tmmark" } } */
26 /* { dg-final { scan-tree-dump-times "__builtin__ITM_free" 2 "tmmark" } } */