------- Additional Comments From uweigand at gcc dot gnu dot org 2005-02-10 14:03 ------- Some more information about the problem.
The __builtin_memset call gets as V_MAY_DEF operands all global variables (using the call_clobbered_vars mechanism). Initially, this does *not* include global_int, because it is not referenced in the function. When transforming the function into SSA form, all such V_MAY_DEF operands get annotated with an SSA_NAME. During SRA, the intializer &global_int is copied into a statement, thus exposing global_int as referenced variable. The generate_element_init function calls find_new_referenced_vars, which notices that fact, and adds global_int to call_clobbered_vars. After SRA is done, another SSA rename pass renames all existing uses of this new variable. Note, however, that at this point the V_MAY_DEF list of the __builtin_memset call does *not* (yet) contain global_int, and so it is not renamed. During a later optimzation pass (redphi), the operand list of the __builtin_memset call is recomputed (for unrelated reasons). At this point, the full contents of the call_clobbered_vars list, now including global_int, is added as V_MAY_DEF operands. All such operands that were already in that list before will keep their SSA_NAME numbers. However, global_int was not in that list before and thus gets entered as pure DECL into the V_MAY_DEF list. Also, the redphi pass does not mark this variable as to-be-renamed (it doesn't actually know anything about the variable), and thus it remains unrenamed. At the end of the redphi pass, verify_ssa goes through all operands of all statements, and aborts because it finds a DECL as V_MAY_DEF. -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=19853