http://gcc.gnu.org/bugzilla/show_bug.cgi?id=49618
--- Comment #10 from Eric Botcazou <ebotcazou at gcc dot gnu.org> 2011-07-04 10:14:40 UTC --- > Eric/Richard, what do you think? The comments seem to be fuzzy to me, some > comments say that MEM_NOTRAP_P only apply to the position where the MEM is > originally used (and in this case the __dso_handle var is read only guarded > with if (__dso_handle != NULL), on the other side I wonder if we ever clear > MEM_NOTRAP_P on unguarded DECL_WEAK var references. I think that DECL_WEAK should always prevent MEM_NOTRAP_P from being set. This is a regression because of the change in set_mem_attributes_minus_bitpos, right? The code on the 4.5 branch reads: if (DECL_P (base)) { if (CODE_CONTAINS_STRUCT (TREE_CODE (base), TS_DECL_WITH_VIS)) MEM_NOTRAP_P (ref) = !DECL_WEAK (base); else MEM_NOTRAP_P (ref) = 1; } else MEM_NOTRAP_P (ref) = TREE_THIS_NOTRAP (base); Maybe the first part should be reinstated.