aboutsummaryrefslogtreecommitdiff
path: root/gcc/c
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/c')
-rw-r--r--gcc/c/c-decl.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/gcc/c/c-decl.c b/gcc/c/c-decl.c
index 53b2b5b..3c7b306 100644
--- a/gcc/c/c-decl.c
+++ b/gcc/c/c-decl.c
@@ -8853,6 +8853,13 @@ finish_struct (location_t loc, tree t, tree fieldlist, tree attributes,
= c_build_qualified_type (fmain_type, TYPE_QUALS (ftype));
}
}
+
+ if (TREE_CODE (t) == UNION_TYPE
+ && AGGREGATE_TYPE_P (TREE_TYPE (field))
+ && TYPE_REVERSE_STORAGE_ORDER (t)
+ != TYPE_REVERSE_STORAGE_ORDER (TREE_TYPE (field)))
+ warning_at (DECL_SOURCE_LOCATION (field), OPT_Wscalar_storage_order,
+ "type punning toggles scalar storage order");
}
/* Now we have the truly final field list.