diff options
author | Andrew Burgess <aburgess@redhat.com> | 2022-10-12 11:45:53 +0100 |
---|---|---|
committer | Andrew Burgess <aburgess@redhat.com> | 2022-10-19 14:32:22 +0100 |
commit | d0a7ca87ab208d72b2c6a9d44e30fe20c3c0542e (patch) | |
tree | 046252c76230145d9c6afad2a6c975bfe6334c50 /sim/erc32/Makefile.in | |
parent | e5961d2be503149aaa40927c0a9501c06ca980e5 (diff) | |
download | binutils-d0a7ca87ab208d72b2c6a9d44e30fe20c3c0542e.zip binutils-d0a7ca87ab208d72b2c6a9d44e30fe20c3c0542e.tar.gz binutils-d0a7ca87ab208d72b2c6a9d44e30fe20c3c0542e.tar.bz2 |
sim/erc32: avoid dereferencing type-punned pointer warnings
When building the erc32 simulator I get a few warnings like this:
/tmp/build/sim/../../src/sim/erc32/exec.c:1377:21: warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing]
1377 | sregs->fs[rd] = *((float32 *) & ddata[0]);
| ~^~~~~~~~~~~~~~~~~~~~~~~
The type of '& ddata[0]' will be 'uint32_t *', which is what triggers
the warning.
This commit makes use of memcpy when performing the type-punning,
which resolves the above warnings.
With this change, I now see no warnings when compiling exec.c, which
means that the line in Makefile.in that disables -Werror can be
removed.
There should be no change in behaviour after this commit.
Diffstat (limited to 'sim/erc32/Makefile.in')
-rw-r--r-- | sim/erc32/Makefile.in | 3 |
1 files changed, 0 insertions, 3 deletions
diff --git a/sim/erc32/Makefile.in b/sim/erc32/Makefile.in index 786ae1d..41830aa 100644 --- a/sim/erc32/Makefile.in +++ b/sim/erc32/Makefile.in @@ -32,9 +32,6 @@ SIM_EXTRA_CLEAN = clean-sis # behaviour of UART interrupt routines ... SIM_EXTRA_CFLAGS += -DFAST_UART -I$(srcroot) -# Some modules don't build cleanly yet. -exec.o: SIM_WERROR_CFLAGS = - ## COMMON_POST_CONFIG_FRAG # `sis' doesn't need interf.o. |