Revise -mdisable-fpregs option and add new -msoft-mult option
[official-gcc.git] / gcc / testsuite / gcc.dg / alias-14.c
blob24f0d1c1168cdf4b273c1468f6aaa58ee50a9b22
1 /* { dg-do run } */
2 /* { dg-options "-O2" } */
3 #include <stddef.h>
4 void *a;
5 int *b;
6 struct c {void * a;} c;
7 struct d {short * a;} d;
9 int *ip= (int *)(size_t)2;
10 int **ipp = &ip;
12 int
13 main()
15 float **ptr;
16 void **uptr;
17 int* const* cipp = (int* const*)ipp;
18 /* as an extension we consider void * universal. Writes to it should alias. */
19 asm ("":"=r"(ptr):"0"(&a));
20 a=NULL;
21 *ptr=(float*)(size_t)1;
22 if (!a)
23 __builtin_abort ();
24 a=NULL;
25 if (*ptr)
26 __builtin_abort ();
28 asm ("":"=r"(uptr):"0"(&b));
29 b=NULL;
30 *uptr=(void*)(size_t)1;
31 if (!b)
32 __builtin_abort ();
33 b=NULL;
34 if (*uptr)
35 __builtin_abort ();
37 /* Check that we disambiguate int * and char *. */
38 asm ("":"=r"(ptr):"0"(&b));
39 b=NULL;
40 *ptr=(float*)(size_t)1;
41 if (b)
42 __builtin_abort ();
44 /* Again we should make void * in the structure conflict with any pointer. */
45 asm ("":"=r"(ptr):"0"(&c));
46 c.a=NULL;
47 *ptr=(float*)(size_t)1;
48 if (!c.a)
49 __builtin_abort ();
50 c.a=NULL;
51 if (*ptr)
52 __builtin_abort ();
54 asm ("":"=r"(uptr):"0"(&d));
55 d.a=NULL;
56 *uptr=(void*)(size_t)1;
57 if (!d.a)
58 __builtin_abort ();
59 d.a=NULL;
60 if (*uptr)
61 __builtin_abort ();
63 if ((void *)*cipp != (void*)(size_t)2)
64 __builtin_abort ();
65 *ipp = NULL;
66 if (*cipp)
67 __builtin_abort ();
69 return 0;