modernc.org/ccgo/v3@v3.16.14/lib/testdata/gcc-9.1.0/gcc/testsuite/gcc.c-torture/execute/pr15262-1.c (about) 1 /* PR 15262. 2 The alias analyzer only considers relations between pointers and 3 symbols. If two pointers P and Q point to the same symbol S, then 4 their respective memory tags will either be the same or they will 5 have S in their alias set. 6 7 However, if there are no common symbols between P and Q, TBAA will 8 currently miss their alias relationship altogether. */ 9 struct A 10 { 11 int t; 12 int i; 13 }; 14 15 int foo () { return 3; } 16 17 main () 18 { 19 struct A loc, *locp; 20 float f, g, *p; 21 int T355, *T356; 22 23 /* Avoid the partial hack in TBAA that would consider memory tags if 24 the program had no addressable symbols. */ 25 f = 3; 26 g = 2; 27 p = foo () ? &g : &f; 28 if (*p > 0.0) 29 g = 1; 30 31 /* Store into *locp and cache its current value. */ 32 locp = malloc (sizeof (*locp)); 33 locp->i = 10; 34 T355 = locp->i; 35 36 /* Take the address of one of locp's fields and write to it. */ 37 T356 = &locp->i; 38 *T356 = 1; 39 40 /* Read the recently stored value. If TBAA fails, this will appear 41 as a redundant load that will be replaced with '10'. */ 42 T355 = locp->i; 43 if (T355 != 1) 44 abort (); 45 46 return 0; 47 }