https://gcc.gnu.org/bugzilla/show_bug.cgi?id=120559

--- Comment #6 from Lucian Raul Silistru <lucian.silistru at gmail dot com> ---
(In reply to Andrew Pinski from comment #5)
> struct tx_buffer_entry *entry;
> 
> uint32_t * ptr = (void *)(&entry);
> 
> uint32_t value = (*ptr | (channel & 3));
> // alias violation here, reading a `struct tx_buffer_entry *` value via 
> uint32_t.
> 
> Use -fno-strict-aliasing or fix your code differently.
> 
> https://gist.github.com/shafik/848ae25ee209f698763cffee272a58f8 is a good
> place to start reading up about strict aliasing. But there are many more
> pages about it.

Thanks for confirming. Barely looked at that function with the symptom in the
caller.
2 final questions:
1. Does it affect the caller due to LTO being used?

2. So it is tx_buffer_entry ** -> uint32_t * + deref that just adds an aliasing
violation to just do the same as tx_buffer_entry * -> uint32_t, correct?

Reply via email to