]> git.ipfire.org Git - thirdparty/gcc.git/blame - gcc/testsuite/gcc.dg/builtins-13.c
replace ISL with isl
[thirdparty/gcc.git] / gcc / testsuite / gcc.dg / builtins-13.c
CommitLineData
1331d16f
RS
1/* Copyright (C) 2003 Free Software Foundation.
2
3 Verify that the malloc-like __builtin_ allocation functions are
4 correctly aliased by the compiler.
5
6 Written by Roger Sayle, 12th April 2003. */
7
8/* { dg-do link } */
22b98f35 9/* { dg-options "-ansi" } */
1331d16f
RS
10
11typedef __SIZE_TYPE__ size_t;
12
13extern void abort (void);
14extern void *malloc (size_t);
15extern void *calloc (size_t,size_t);
16
17extern void link_error (void);
18
19static int x;
20
21void test1(void)
22{
23 int *ptr1, *ptr2;
24
25 ptr1 = &x;
26 ptr2 = (int*) malloc (sizeof (int));
27
28 *ptr1 = 12;
29 *ptr2 = 8;
30
31 if (*ptr1 != 12)
32 link_error();
33}
34
35void test2(void)
36{
37 int *ptr1, *ptr2;
38
39 ptr1 = &x;
40 ptr2 = (int*) calloc (1, sizeof (int));
41
42 *ptr1 = 12;
43 *ptr2 = 8;
44
45 if (*ptr1 != 12)
46 link_error ();
47}
48
49int main()
50{
51 test1 ();
52 test2 ();
53 return 0;
54}
55
56#ifndef __OPTIMIZE__
57void link_error (void)
58{
59 abort ();
60}
61#endif
62