1/* { dg-do compile } */ 2/* { dg-options "-O1 -fdump-tree-optimized" } */ 3 4/* Tests for SRA. */ 5 6typedef struct teststruct 7{ 8 double d; 9 char f1; 10} teststruct; 11 12void 13copystruct1 (teststruct param) 14{ 15 teststruct local; 16 param.f1 = 0; 17 local = param; 18 if (local.f1 != 0) 19 link_error (); 20} 21 22void 23copystruct11 (teststruct *param) 24{ 25 teststruct local; 26 param->f1 = 0; 27 local = *param; 28 if (local.f1 != 0) 29 link_error (); 30} 31 32void 33copystruct111 (teststruct param) 34{ 35 teststruct *local = ¶m; 36 param.f1 = 0; 37 if (local->f1 != 0) 38 link_error (); 39} 40 41teststruct globf; 42void 43copystruct1111 (void) 44{ 45 teststruct local; 46 globf.f1 = 0; 47 local = globf; 48 if (local.f1 != 0) 49 link_error (); 50} 51 52void 53copystruct11111 (void) 54{ 55 teststruct *local = &globf; 56 globf.f1 = 0; 57 if (local->f1 != 0) 58 link_error (); 59} 60 61void 62copystruct111111 (teststruct param) 63{ 64 static teststruct local; 65 param.f1 = 0; 66 local = param; 67 if (local.f1 != 0) 68 link_error (); 69} 70 71/* There should be no referenc to link_error. */ 72/* { dg-final { scan-tree-dump-times "link_error" 0 "optimized"} } */ 73/* { dg-final { cleanup-tree-dump "optimized" } } */ 74