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 Fri, 21 Oct 2016, Jakub Jelinek wrote:

> On Fri, Oct 21, 2016 at 08:54:42PM +0300, Ville Voutilainen wrote:
> > >> Or we could add a typegeneric __builtin_launder builtin that would
> > >> immediately fold to its argument.  Then we can change it any time we
> > >> figure
> > >> out we need to do something there.
> > >
> > >
> > > That would work too. I shoulda left this thread on gcc@ :-)
> > >
> > > As an aside, __has_builtin is pretty useful (like __has_include and
> > > __has_attribute).
> > >
> > >
> > 
> > Richard Smith is suggesting that gcc needs a real launder:
> > https://godbolt.org/g/Ymdm0Y
> 
> 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.

Richard.


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