NoQ added a comment.

I looked up the history. I believe this refers to 
https://clang.llvm.org/docs/LanguageExtensions.html#memory-references-to-specified-segments:

> Annotating a pointer with address space #256 causes it to be code generated 
> relative to the X86 GS segment register, address space #257 causes it to be 
> relative to the X86 FS segment, and address space #258 causes it to be 
> relative to the X86 SS segment. Note that this is a very very low-level 
> feature that should only be used if you know what you’re doing (for example 
> in an OS kernel).

So basically `((void *__attribute__((address_space(256))) *)0)` is a valid 
pointer that can be safely dereferenced.

I'm not aware of other situations of this kind. Probably this address space 
range can be hardcoded, and/or a run-time checker option can be provided to 
enable/disable this behavior.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D122841/new/

https://reviews.llvm.org/D122841

_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to