https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110760
Richard Biener <rguenth at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Assignee|unassigned at gcc dot gnu.org |rguenth at gcc dot gnu.org Last reconfirmed| |2023-07-21 Status|UNCONFIRMED |ASSIGNED Ever confirmed|0 |1 Keywords| |wrong-code --- Comment #5 from Richard Biener <rguenth at gcc dot gnu.org> --- Vector types follow the same rules as scalar types because we eventually lower them to scalar ops. So yes, I think this is a bug. Now, it will be difficult to exploit since the values are not actually used. One trick would be to CSE with a later tem = (unsigned)b[1] - (unsigned)c[1]; where for scalar code FRE would eliminate the above with the earlier a[2] doing tem = (unsigned)a[2]; but it currently doesn't do that for vectors and as the vectorizer introduces the wrong behavior we are not going to decompose that to scalars either. The particular case in question should be easy to fix though.