struct a{int i;}; static const struct a b = {1}; int g(){return b.i;} This should be optimized to just int g(){return 1;}
Confirmed with mainline of today. A case for scalarization. W.
my patch there should be easily adaptable to handle this case.
mine
simple patch not good enough, and no clue how to handle "x = a.b.c.d.e[2].f[4].g"
*** Bug 20284 has been marked as a duplicate of this bug. ***
My patch for PR14841 also works for this case.
Just checked in a patch.
so closing as fixed.