* tree-ssa-loop-manip.c (split_loop_exit_edge): Return the new block.
[official-gcc.git] / gcc / testsuite / gcc.dg / builtins-13.c
blobbefcd3447ad7dd7403cbc57aa8923d780c144a17
1 /* Copyright (C) 2003 Free Software Foundation.
3 Verify that the malloc-like __builtin_ allocation functions are
4 correctly aliased by the compiler.
6 Written by Roger Sayle, 12th April 2003. */
8 /* { dg-do link } */
10 typedef __SIZE_TYPE__ size_t;
12 extern void abort (void);
13 extern void *malloc (size_t);
14 extern void *calloc (size_t,size_t);
16 extern void link_error (void);
18 static int x;
20 void test1(void)
22 int *ptr1, *ptr2;
24 ptr1 = &x;
25 ptr2 = (int*) malloc (sizeof (int));
27 *ptr1 = 12;
28 *ptr2 = 8;
30 if (*ptr1 != 12)
31 link_error();
34 void test2(void)
36 int *ptr1, *ptr2;
38 ptr1 = &x;
39 ptr2 = (int*) calloc (1, sizeof (int));
41 *ptr1 = 12;
42 *ptr2 = 8;
44 if (*ptr1 != 12)
45 link_error ();
48 int main()
50 test1 ();
51 test2 ();
52 return 0;
55 #ifndef __OPTIMIZE__
56 void link_error (void)
58 abort ();
60 #endif