[Bug target/126640] New: riscv: -mtune can introduce misaligned vectors.
"rdapp at gcc dot gnu.org via Gcc-bugs" <[email protected]> Tue, 04 Aug 2026 13:32:37 +0000
| Newsgroups | gmane.comp.gcc.bugs |
|---|---|
| Message-ID | <[email protected]/bugzilla/> |
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D126640
Bug ID: 126640
Summary: riscv: -mtune can introduce misaligned vectors.
Product: gcc
Version: 15.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: target
Assignee: unassigned at gcc dot gnu.org
Reporter: rdapp at gcc dot gnu.org
CC: kito at gcc dot gnu.org, law at gcc dot gnu.org
Target Milestone: ---
Target: riscv
While looking into the the Oilsm proposal, I noticed that with e.g.
-mtune=3Dgeneric-ooo (which enables misaligned vectors) we do emit misalign=
ed
vectors, regardless of the -march. IMHO that's wrong and I know that I
introduced this :) -march=3Dfoo -mtune=3Dbar code must always be executabl=
e on any
foo architecture even if it's slow. Potentially faulting vector accesses a=
re
contrary to this principle. I don't think the blast radius of correcting it
would be too large. Perhaps we should just define a "generic-ooo" CPU/arch=
in
addition.
One way or another, right now -mtune can create executables that won't run =
on
CPUs that trap on misaligned vectors.
Kito, how is the situation on the LLVM side here?=