[Bug c/90027] New: misalign variable access by piece load/store even when define STRICT_ALIGNMENT nonzero
zhongyunde at huawei dot com
gcc-bugzilla@gcc.gnu.org
Tue Apr 9 17:38:00 GMT 2019
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=90027
Bug ID: 90027
Summary: misalign variable access by piece load/store even when
define STRICT_ALIGNMENT nonzero
Product: gcc
Version: 7.3.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c
Assignee: unassigned at gcc dot gnu.org
Reporter: zhongyunde at huawei dot com
Target Milestone: ---
base gcc 7.3.0, in function expand_expr_real_1 we can see the follow code:
else if (SLOW_UNALIGNED_ACCESS (mode, align))
temp = extract_bit_field (temp, GET_MODE_BITSIZE (mode),
0, TYPE_UNSIGNED (TREE_TYPE (exp)),
(modifier == EXPAND_STACK_PARM
? NULL_RTX : target),
mode, mode, false);
it means even when we define STRICT_ALIGNMENT 1, it may still extract the store
insns with narrow alignment.
In Gcc internal, it say that SLOW_UNALIGNED_ACCESS should produce a nonzero
value when STRICT_ALIGNMENT is nonzero.
A test cases:
int foo ()
{
volatile int *pswData = 2; /* point to address 2 is not aligned with 4
bytes. */
return *pswData - *pswData;
}
More information about the Gcc-bugs
mailing list