https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96810
Jakub Jelinek <jakub at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |jakub at gcc dot gnu.org Resolution|--- |INVALID Status|UNCONFIRMED |RESOLVED --- Comment #1 from Jakub Jelinek <jakub at gcc dot gnu.org> --- The standard says this is unspecified behavior, but the unspecified behavior happens at runtime, so if the compiler could detect it at compile time, it would need to be at most a warning (if the code is never called, there is no unspecified behavior). Generally this isn't something that can be detected at compile time, e.g. the target data can be in a different function from target, or there could be target exit data that unmaps it in between and makes it valid, or the fact that the pointer must alias the array could be not known to the compiler, etc. And the testcase is rejected at runtime: libgomp: Trying to map into device [0x7ffc13463cbc..0x7ffc13463d0c) object when [0x7ffc13463cb0..0x7ffc13463cc0) is already mapped