PR c++/67273
[official-gcc.git] / gcc / testsuite / gcc.target / arm / pr42495.c
blob7e08cf2985063b77d559e83a7709008704825cbd
1 /* { dg-options "-mthumb -Os -fpic -fdump-rtl-hoist" } */
2 /* { dg-require-effective-target arm_thumb1_ok } */
3 /* { dg-require-effective-target fpic } */
4 /* Make sure all calculations of gObj's address get hoisted to one location. */
5 /* { dg-final { scan-rtl-dump "PRE/HOIST: end of bb .* copying expression" "hoist" } } */
7 struct st_a {
8 int data;
9 };
11 struct st_b {
12 struct st_a *p_a;
13 struct st_b *next;
16 extern struct st_b gObj;
17 extern void foo(int, struct st_b*);
19 int goo(struct st_b * obj) {
20 struct st_a *pa;
21 if (gObj.p_a->data != 0) {
22 foo(gObj.p_a->data, obj);
24 pa = obj->p_a;
25 if (pa == 0) {
26 return 0;
27 } else if (pa == gObj.p_a) {
28 return 0;
30 return pa->data;