aboutsummaryrefslogtreecommitdiff
path: root/gcc/config/loongarch
diff options
context:
space:
mode:
authorXi Ruoyao <xry111@mengyan1223.wang>2022-04-27 19:45:59 +0800
committerLulu Cheng <chenglulu@loongson.cn>2022-04-28 09:20:40 +0800
commitd1ee29fd7fb972fee141a0e475f780be4253758a (patch)
tree835558d68d07507c933641844d96f8797227c5e5 /gcc/config/loongarch
parentba949a6af46993fbd7160a7fea0b8f8ab11bc7bd (diff)
downloadgcc-d1ee29fd7fb972fee141a0e475f780be4253758a.zip
gcc-d1ee29fd7fb972fee141a0e475f780be4253758a.tar.gz
gcc-d1ee29fd7fb972fee141a0e475f780be4253758a.tar.bz2
loongarch: ignore zero-size fields in calling convention
gcc/ * config/loongarch/loongarch.cc (loongarch_flatten_aggregate_field): Ignore empty fields for RECORD_TYPE. gcc/testsuite/ * gcc.target/loongarch/zero-size-field-pass.c: New test. * gcc.target/loongarch/zero-size-field-ret.c: New test.
Diffstat (limited to 'gcc/config/loongarch')
-rw-r--r--gcc/config/loongarch/loongarch.cc3
1 files changed, 3 insertions, 0 deletions
diff --git a/gcc/config/loongarch/loongarch.cc b/gcc/config/loongarch/loongarch.cc
index f22150a..80046b6 100644
--- a/gcc/config/loongarch/loongarch.cc
+++ b/gcc/config/loongarch/loongarch.cc
@@ -329,6 +329,9 @@ loongarch_flatten_aggregate_field (const_tree type,
if (!TYPE_P (TREE_TYPE (f)))
return -1;
+ if (DECL_SIZE (f) && integer_zerop (DECL_SIZE (f)))
+ continue;
+
HOST_WIDE_INT pos = offset + int_byte_position (f);
n = loongarch_flatten_aggregate_field (TREE_TYPE (f), fields, n,
pos);