Debian Codegraph @

gcc/testsuite/g++.dg/ipa/pr65765.C

raw
1 // PR ipa/65765
2 // { dg-do run }
3 // { dg-options "-O2" }
4
5 int a, b, c, d, e;
6 unsigned char h[] = { 1, 1 };
7
8 __attribute__ ((cold)) int ModRM_Mode () { return a; }
9
10 int
11 ModRM_RM (int p1)
12 {
13 return p1;
14 }
15
16 __attribute__ ((cold)) static bool ModRM_hasSIB (unsigned char p1)
17 {
18 return ModRM_Mode () != 1 && ModRM_RM (p1);
19 }
20
21 __attribute__ ((cold)) static bool ModRM_hasRIP (unsigned char p1)
22 {
23 return ModRM_Mode () && ModRM_RM (p1);
24 }
25
26 unsigned char *
27 DisassembleHeapAccess (unsigned char *p1)
28 {
29 b = *p1++;
30 if (ModRM_hasSIB (b))
31 c = *p1++;
32 int f = c, g = 0;
33 d = ModRM_hasRIP (g);
34 e = f == 0;
35 if (e)
36 p1 += sizeof 0;
37 return p1;
38 }
39
40 int
41 main ()
42 {
43 if (DisassembleHeapAccess (h) != h + 2)
44 __builtin_abort ();
45 }