riscv32 : -mno-strict-align has no effect
Henri Cloetens
henri.cloetens@blueice.be
Tue Jan 21 08:20:00 GMT 2020
Hello,
I dont know why you want to work on a target with unaligned accesses,
but there are
real ones that have this. I am working on a custom processor, and it has
it. As far as
I know - not sure, have to check - there are also other target that have it.
Best Regards,
Henri.
On 01/20/2020 11:23 PM, Jim Wilson wrote:
> On Sun, Jan 19, 2020 at 5:39 PM Alex Rocha Prado <alex.prado@nxp.com> wrote:
>> It happens that both line generate the same code, so there is some kind of problem with gcc, correct ?
> -mno-strict-align does have an effect, but it isn't very useful. The
> problem here is that gcc knows that the target does not support
> unaligned accesses, so it is refusing to produce them even when
> -mno-strict-align is used. Unfortunately, the only supported target
> with unaligned accesses is the fake -mtune=size target, which exists
> only for use with the -Os option. So if you use -mtune=size
> -mno-strict-align you can get the result you probably want. However,
> I wouldn't recommend doing that, as I can't guarantee that -mtune=size
> will work the same in the future. If you do have a target that
> supports unaligned accesses, then you should add support for that
> target to gcc, and then using -mtune=yourtarget -mno-strict-align will
> work. If you don't have a target that supports unaligned accesses,
> then why do you want the compiler to emit broken code?
>
> This alignment stuff should probably be rewritten at some point to
> make the usage of the options more obvious, but I have no idea when
> that will happen. At the moment, there is no incentive, as gcc
> doesn't have support for any RISC-V targets that support unaligned
> accesses.
>
> Jim
>
More information about the Gcc-help
mailing list