This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [trans-mem] random segfault
- From: Richard Henderson <rth at redhat dot com>
- To: Aldy Hernandez <aldyh at redhat dot com>
- Cc: Patrick Marlier <patrick dot marlier at unine dot ch>, FELBER Pascal <pascal dot felber at unine dot ch>, gcc-patches at gcc dot gnu dot org
- Date: Tue, 15 Jun 2010 09:32:22 -0700
- Subject: Re: [trans-mem] random segfault
- References: <4BF51CF2.4060201@unine.ch> <4C167D42.6030600@unine.ch> <20100615142525.GC27062@redhat.com>
On 06/15/2010 07:25 AM, Aldy Hernandez wrote:
> Fixed by making sure we're not recursing on the same variable.
>
> OK for branch?
>
> * trans-mem.c (thread_private_new_memory): Avoid infinite recursion.
Ah, a side-effect of the last patch that changed the insert handling.
I'm not sure this is right, Aldy, since this only detects a chain of
length 1, and not longer chains.
I think you have to go back and change
slot = htab_find_slot (tm_new_mem_hash, &elt, INSERT)
elt_p = (tm_new_mem_map_t *) *slot;
if (elt_p)
return elt_p->local_new_memory;
/* Optimistically assume the memory is transaction local during
processing. This catches recursion into this variable. */
*slot = elt_p = XNEW (tm_new_mem_map_t);
elt_p->val = val;
elt_p->local_new_memory = mem_transaction_local;
/* Search DEF chain... */
...
new_memory_ret:
elt_p->local_new_memory = retval;
return retval;
This should fix both bugs since (1) we detect recursion on longer
chains and (2) we don't touch SLOT after recursion; we only touch
ELT_P, which does not change with hash resizing.
r~