zygoloid wrote:

> But yes, the short answer is that the code as written should work on Morello 
> and CHERI-RISC-V.

Great, thanks.

> > > The std::launder may be unnecessary
> > 
> > 
> > Formally I think it's correct and necessary for the pointer and integer 
> > case because an array element and an object for which the array provides 
> > storage are not pointer-interconvertible, but it's incorrect for the 
> > `unsigned char` case because there's no in-lifetime `unsigned char` object 
> > at the provided address.
> 
> I'll defer to your expert opinion for what exactly to do here. If the launder 
> is needed for the other types but wrong for GetLSB the obvious fix is to just 
> inline a simple specialisation of As, assuming direct access to `Data` is 
> still permitted despite there being no in-lifetime `unsigned char`.

I suppose we may as well be pedantically correct here and specialize `As`. The 
direct access to `Data` is at least *intended* to work, although at the moment 
there's no lifetime exception for accesses via `unsigned char`, just an 
aliasing exception.

https://github.com/llvm/llvm-project/pull/111995
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to