This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug tree-optimization/49618] When building uClibc with GCC 4.6.1 old_atexit is miscompiled
- From: "ebotcazou at gcc dot gnu.org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Mon, 4 Jul 2011 10:16:14 +0000
- Subject: [Bug tree-optimization/49618] When building uClibc with GCC 4.6.1 old_atexit is miscompiled
- Auto-submitted: auto-generated
- References: <bug-49618-4@http.gcc.gnu.org/bugzilla/>
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.