diff options
author | Eric Botcazou <ebotcazou@adacore.com> | 2021-05-07 20:44:36 +0200 |
---|---|---|
committer | Eric Botcazou <ebotcazou@adacore.com> | 2021-05-07 20:47:48 +0200 |
commit | e2bc5b6c04df820017c497a2578bd3c4c7b6c89b (patch) | |
tree | 73027313566ab3c2f1d9fb5e60bbce6177735b14 /gcc/tree.h | |
parent | 7af392687952608b988bd5a476583106b3f51740 (diff) | |
download | gcc-e2bc5b6c04df820017c497a2578bd3c4c7b6c89b.zip gcc-e2bc5b6c04df820017c497a2578bd3c4c7b6c89b.tar.gz gcc-e2bc5b6c04df820017c497a2578bd3c4c7b6c89b.tar.bz2 |
Do not apply scalar storage order to pointer fields
Pointer fields (and vector fields originally) were not really considered
when the scalar_storage_order attribute, so they are swapped as well.
As pointed out, this is problematic to describe in DWARF and probably
not very useful in any case, so this pulls them out.
gcc/
* doc/extend.texi (scalar_storage_order): Mention effect on pointer
and vector fields.
* tree.h (reverse_storage_order_for_component_p): Return false if
the type is a pointer.
gcc/c/
* c-typeck.c (build_unary_op) <ADDR_EXPR>: Do not issue an error
on the address of a pointer field in a record with reverse SSO.
gcc/testsuite/
* gcc.dg/sso-12.c: New test.
Diffstat (limited to 'gcc/tree.h')
-rw-r--r-- | gcc/tree.h | 4 |
1 files changed, 3 insertions, 1 deletions
@@ -4989,7 +4989,9 @@ static inline bool reverse_storage_order_for_component_p (tree t) { /* The storage order only applies to scalar components. */ - if (AGGREGATE_TYPE_P (TREE_TYPE (t)) || VECTOR_TYPE_P (TREE_TYPE (t))) + if (AGGREGATE_TYPE_P (TREE_TYPE (t)) + || POINTER_TYPE_P (TREE_TYPE (t)) + || VECTOR_TYPE_P (TREE_TYPE (t))) return false; if (TREE_CODE (t) == REALPART_EXPR || TREE_CODE (t) == IMAGPART_EXPR) |