------- Comment #6 from jakub at gcc dot gnu dot org 2009-03-06 12:48 ------- The problem is that mark_all_vars_used only marks blocks used by actual code, but on the testcase the only reference to a one BLOCK is from TYPE_MAX_VALUE (TYPE_DOMAIN (type)) containing a PLUS_EXPR with that BLOCK as TREE_BLOCK.
IMHO either we need to talk also types in remove_unused_locals/mark_all_vars_used, or we should drop TREE_BLOCK stuff from expressions referenced from types during gimplification (do we actually ever care about TREE_BLOCK of expressions in TYPE_{MIN,MAX}_VALUE, TYPE_SIZE{,_UNIT}, DECL_SIZE{,_UNIT} etc.?), or during inlining we should just ignore remapping of blocks for these expressions. If a BLOCK isn't found for them, no big deal, just drop it. -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=39367