Bug 15838 - "Inline" value of static struct
Summary: "Inline" value of static struct
Alias: None
Product: gcc
Classification: Unclassified
Component: tree-optimization (show other bugs)
Version: 4.0.0
: P2 enhancement
Target Milestone: 4.1.0
Assignee: Kazu Hirata
Keywords: missed-optimization
: 20284 (view as bug list)
Depends on: 14841
Blocks: 3713
  Show dependency treegraph
Reported: 2004-06-06 01:22 UTC by Andrew Pinski
Modified: 2005-05-08 23:57 UTC (History)
4 users (show)

See Also:
Known to work:
Known to fail:
Last reconfirmed: 2005-02-21 20:59:50


Note You need to log in before you can comment on or make changes to this bug.
Description Andrew Pinski 2004-06-06 01:22:43 UTC
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;}
Comment 1 Wolfgang Bangerth 2004-06-15 20:01:06 UTC
Confirmed with mainline of today. A case for scalarization. 
Comment 2 Steven Bosscher 2004-08-30 22:33:51 UTC
my patch there should be easily adaptable to handle this case. 
Comment 3 Steven Bosscher 2004-08-31 18:13:43 UTC
Comment 4 Steven Bosscher 2004-08-31 21:01:02 UTC
simple patch not good enough, and no clue how to 
handle "x = a.b.c.d.e[2].f[4].g" 
Comment 5 Andrew Pinski 2005-03-02 16:04:33 UTC
*** Bug 20284 has been marked as a duplicate of this bug. ***
Comment 6 Kazu Hirata 2005-05-07 04:48:49 UTC
My patch for PR14841 also works for this case.
Comment 7 Kazu Hirata 2005-05-08 21:30:42 UTC
Just checked in a patch.
Comment 8 Andrew Pinski 2005-05-08 23:57:55 UTC
so closing as fixed.