http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53952
Alexandre Oliva <aoliva at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|UNCONFIRMED |NEW Last reconfirmed| |2012-11-29 CC| |aoliva at gcc dot gnu.org Ever Confirmed|0 |1 --- Comment #1 from Alexandre Oliva <aoliva at gcc dot gnu.org> 2012-11-29 00:41:36 UTC --- The problem is that SRA replaces a copy of an iterator type to a variable that was not addressable with a copy of the pointer held in the iterator. To that end, it takes the address of the iterator. This takes place after mudflap1, so that the address range for the variable is never registered, but before mudflap2, that introduces the access checks for addressed variables and marking them addressable. Oops. (it's the iterator passed to _M_insert_aux, in the copy of push_back inlined into main) This ugly patch fixes it, but I don't really like it. Any other suggestions? --- a/gcc/tree-mudflap.c +++ b/gcc/tree-mudflap.c @@ -933,6 +933,12 @@ mf_xform_derefs_1 (gimple_stmt_iterator *iter, tree *tp, return; } + /* SRA takes the address of variables that were not addressable. + Don't check them. */ + if (TREE_CODE (addr) == ADDR_EXPR + && !TREE_ADDRESSABLE (TREE_OPERAND (addr, 0))) + return; + mf_build_check_statement_for (base, limit, iter, location, dirflag); } /* Transform