[Bug tree-optimization/103964] [9/10/11/12 Regression] OVS miscompilation since r0-92313-g5006671f1aaa63cd
rguenth at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Tue Jan 11 14:06:46 GMT 2022
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103964
--- Comment #8 from Richard Biener <rguenth at gcc dot gnu.org> ---
(In reply to Ilya Maximets from comment #7)
> One thing that is not clear to me is if the following code has an UB or not:
>
> struct member* pos;
> struct ovs_list start;
>
> pos = (struct member *)(void*)((uintptr_t)(&start) - 64);
> ovs_list_insert((void *)((uintptr_t)pos + 64), &member->elem);
>
> ?
>
> This code works fine. Basically, the question is: can we cast and store
> the random (aligned) integer to a pointer type, if we're not going to
> perform any kind of pointer arithmetic (using the integer arithmetic for
> the ovs_list_insert) nor dereference it, unless it points to the actual
> valid object?
That should be OK, yes.
More information about the Gcc-bugs
mailing list