This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: Strenghten assumption about dynamic type changes (placement new)
- From: Jan Hubicka <hubicka at ucw dot cz>
- To: Richard Biener <richard dot guenther at gmail dot com>
- Cc: Jan Hubicka <hubicka at ucw dot cz>, Jason Merrill <jason at redhat dot com>, GCC Patches <gcc-patches at gcc dot gnu dot org>
- Date: Tue, 22 Jul 2014 17:17:20 +0200
- Subject: Re: Strenghten assumption about dynamic type changes (placement new)
- Authentication-results: sourceware.org; auth=none
- References: <20140702201805 dot GB15987 at kam dot mff dot cuni dot cz> <53B49446 dot 7090402 at redhat dot com> <20140708135023 dot GC27691 at kam dot mff dot cuni dot cz> <53C87213 dot 1050604 at redhat dot com> <20140718100335 dot GA7671 at kam dot mff dot cuni dot cz> <53CA76FF dot 8080101 at redhat dot com> <20140719154408 dot GA8665 at kam dot mff dot cuni dot cz> <CAFiYyc0hDA+9G+wBVkf8Gif8vsDdpvyf4r3X8P=7G-P=QaWwqQ at mail dot gmail dot com> <20140722135434 dot GA12329 at kam dot mff dot cuni dot cz> <CAFiYyc37YkpYFGX2WJ14BUyEQ5k6ggvLrntsemtMEmat+6RgXA at mail dot gmail dot com>
> I don't see why
>
> long x[1024];
>
> Q *q = new (x) Q;
> q->~Q ();
> new (x) T;
>
> would be invalid. I also don't see why
>
> Q q;
> q.~Q ();
> new (&q) T;
>
> would be. Object lifetime is precisely specified and I don't see where it is
> tied to (static) storage lifetime.
This is precisely the testcase I posted on beggining of this thread.
I do not see how the testcases can work with aliasing rules in the case Q's and T's
memory is known to not alias.
Either we need to define what is and is not supported or go for speculative devirt more often.
Honza