This is the mail archive of the libstdc++@gcc.gnu.org mailing list for the libstdc++ project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: C++17 std::launder and aliasing


On 24 October 2016 at 10:41, Richard Biener <rguenther@suse.de> wrote:
>> Seems that testcase is devirtualization related.
>> With -O3 -fno-devirtualize we return 3 (but still no calls).
>> With asm ("" : "+g" (p)); before return p; in launder we don't devirtualize
>> it any more and return 3 in the end.  Is the testcase only valid
>> with std::launder and not valid otherwise (I hope so, otherwise we are in
>> big trouble with devirtualization)?
>
> I believe the testcase shows a bug in devirtualization.  (stpuid
> godbolt.org having no way to textually extract the source easily)
>
> Please file a GCC bugreport.  GCC shouldn't miscompile this even
> without std::launder.


Note that A::f() can be in a different translation unit, so we still
need the optimization
barrier in some cases, even if in this particular case as written we wouldn't.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]