http://gcc.gnu.org/bugzilla/show_bug.cgi?id=48506
Richard Guenther <rguenth at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|UNCONFIRMED |NEW Last reconfirmed| |2011.04.08 08:44:22 Ever Confirmed|0 |1 --- Comment #4 from Richard Guenther <rguenth at gcc dot gnu.org> 2011-04-08 08:44:22 UTC --- Hmm, it _should_ be able to fold g.i to 0. It doesn't because targetm.binds_local_p () returns false on g because its DECL_COMMON. Maybe not so on darwin? 6779 /* Uninitialized COMMON variable may be unified with symbols 6780 resolved from other modules. */ 6781 else if (DECL_COMMON (exp) 6782 && !resolved_locally 6783 && (DECL_INITIAL (exp) == NULL 6784 || DECL_INITIAL (exp) == error_mark_node)) 6785 local_p = false; thus -fno-common makes the testcase fail for me. I'd say change it to have an explicit initializer, const struct Foo g = { 0 }; and scan for "return 0;" instead.