[EXT] Re: riscv32 : -mno-strict-align has no effect

Alex Rocha Prado alex.prado@nxp.com
Mon Jan 20 12:52:00 GMT 2020

Hi Stefan,

I am sorry, I did not understand why the example is not a good one. My intention is exactly making sure the compiler notice it is an unaligned access and by using -mno-strict-align it generate regular lw/st instructions (since the hardware can handle it nicely).


-----Original Message-----
From: Stefan Ring <stefanrin@gmail.com> 
Sent: Monday, January 20, 2020 4:17 AM
To: Alex Rocha Prado <alex.prado@nxp.com>
Cc: gcc-help@gcc.gnu.org
Subject: [EXT] Re: riscv32 : -mno-strict-align has no effect

Caution: EXT Email

On Mon, Jan 20, 2020 at 2:39 AM Alex Rocha Prado <alex.prado@nxp.com> wrote:
>   Given the test source code below (example):
> void foo(void)
> {
>    *((int*) 0x1001) = *((int*) 0x2003); } [...] It happens that both 
> line generate the same code, so there is some kind of problem with gcc, correct ?

I don't think this is a good example, as the compiler can see from the constants that the addresses are not aligned.

More information about the Gcc-help mailing list