Index: testsuite/gcc.dg/lim_store_dse.c =================================================================== --- testsuite/gcc.dg/lim_store_dse.c (revision 0) +++ testsuite/gcc.dg/lim_store_dse.c (revision 0) @@ -0,0 +1,37 @@ +/* { dg-do compile } */ +/* { dg-options "-O2 -fdump-tree-dse-details" } */ + +#define N 16 +#define M 2 + +struct S +{ + unsigned int x; + unsigned int y; +} pS[100]; + + +void +foo (void) +{ + int i, j; + unsigned int ub[N] = { 1, 3, 6, 9, 12, 15, 18, 21, 24, 27, 30, 33, 36, 39, 42, 45 }; + unsigned int uc[N] = { 1, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15 }; + unsigned int sumx, sumy; + + for (i = 0; i < N - 1; i++) + { + pS[i].x = 0; + pS[i].y = 0; + for (j = 0; j < M; j++) + { + sumx = ub[i + j]; + sumy = uc[i + j]; + pS[i].x += sumx; + pS[i].y += sumy; + } + } +} + +/* { dg-final { scan-tree-dump-times "Deleted dead store" 2 "dse2" } } */ +/* { dg-final { cleanup-tree-dump "dse*" } } */