https://gcc.gnu.org/bugzilla/show_bug.cgi?id=69336
Bug ID: 69336 Summary: Constant value not detected Product: gcc Version: 6.0 Status: UNCONFIRMED Keywords: missed-optimization Severity: enhancement Priority: P3 Component: tree-optimization Assignee: unassigned at gcc dot gnu.org Reporter: glisse at gcc dot gnu.org Target Milestone: --- Created attachment 37384 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=37384&action=edit testcase This code was posted on the boost ML for unrelated reasons, I just commented out the last line. Compiling with -O3, I would expect the whole thing to compile to nothing, but instead I get in the .optimized dump the rather sad: cmap._values[1].second.second = "pear"; _12 = MEM[(const char * const &)&cmap]._values[1].second.second; if (_12 == 0B) I didn't check, it might be that just one more pass would get it, dom3 is quite busy on this example, but unless we intend to loop on passes, I believe we should have optimized this already in some earlier pass. I am sure there are already several PRs about similar issues, feel free to close this one if it seems too redundant.