[Bug c/87581] Misaligned 16-bit read trap on x86 platform should be either fixed or documented.
egallager at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Thu Oct 11 03:25:00 GMT 2018
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87581
Eric Gallager <egallager at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |egallager at gcc dot gnu.org
--- Comment #2 from Eric Gallager <egallager at gcc dot gnu.org> ---
There are warnings from -Wcast-align=strict and -Wconversion that might be
relevant:
$ /usr/local/bin/gcc -c -O3 -fPIC -Wall -Wextra -pedantic -Wconversion
-Wcast-align=strict c.c
c.c: In function 'compute':
c.c:11:34: warning: cast increases required alignment of target type
[-Wcast-align]
11 | #define READ_UINT16(ptr) (*(uint16_t *)(ptr))
| ^
c.c:19:23: note: in expansion of macro 'READ_UINT16'
19 | int newval = (int)READ_UINT16(b1) + value;
| ^~~~~~~~~~~
c.c:12:34: warning: cast increases required alignment of target type
[-Wcast-align]
12 | #define WRITE_UINT16(ptr, val) (*(uint16_t *)(ptr) = (val))
| ^
c.c:20:5: note: in expansion of macro 'WRITE_UINT16'
20 | WRITE_UINT16(b2, newval);
| ^~~~~~~~~~~~
c.c:12:54: warning: conversion from 'int' to 'uint16_t' {aka 'short unsigned
int'} may change value [-Wconversion]
12 | #define WRITE_UINT16(ptr, val) (*(uint16_t *)(ptr) = (val))
| ^
c.c:20:5: note: in expansion of macro 'WRITE_UINT16'
20 | WRITE_UINT16(b2, newval);
| ^~~~~~~~~~~~
$
More information about the Gcc-bugs
mailing list