Re: riscv32 : -mno-strict-align has no effect

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Sun, Jan 19, 2020 at 5:39 PM Alex Rocha Prado <alex.prado@xxxxxxx> 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



[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux