aboutsummaryrefslogtreecommitdiff
path: root/gcc/gimple-fold.c
diff options
context:
space:
mode:
authorJakub Jelinek <jakub@redhat.com>2020-11-27 11:23:45 +0100
committerJakub Jelinek <jakub@redhat.com>2020-11-27 11:25:10 +0100
commitbf0a63a1f47525d1c466dbb84616dcb72010affa (patch)
treeb78eed14726ad5e61976e8660ed6d759f8ec3d8f /gcc/gimple-fold.c
parentf324479caf0ac326534f4fcf72cb12991ccddb3d (diff)
downloadgcc-bf0a63a1f47525d1c466dbb84616dcb72010affa.zip
gcc-bf0a63a1f47525d1c466dbb84616dcb72010affa.tar.gz
gcc-bf0a63a1f47525d1c466dbb84616dcb72010affa.tar.bz2
gimple-fold: Fix another __builtin_clear_padding ICE
When playing with __builtin_bit_cast, I have noticed __builtin_clear_padding ICE on the G class below. The artificial field with D type has offset 0 and size 8 bytes, but the following artificial field with E type has offset 0 and size 0, so it triggers the asserts that we don't move current position backwards. Fixed by ignoring is_empty_type (TREE_TYPE (field)) fields, all of their bits are padding which is what is added when skipping over to next field anyway. 2020-11-27 Jakub Jelinek <jakub@redhat.com> PR libstdc++/88101 * gimple-fold.c (clear_padding_type): Ignore fields with is_empty_type types. * g++.dg/torture/builtin-clear-padding-3.C: New test.
Diffstat (limited to 'gcc/gimple-fold.c')
-rw-r--r--gcc/gimple-fold.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/gcc/gimple-fold.c b/gcc/gimple-fold.c
index a821b64..1f3d80e 100644
--- a/gcc/gimple-fold.c
+++ b/gcc/gimple-fold.c
@@ -4533,6 +4533,8 @@ clear_padding_type (clear_padding_struct *buf, tree type, HOST_WIDE_INT sz)
"well defined padding bits for %qs",
field, "__builtin_clear_padding");
}
+ else if (is_empty_type (TREE_TYPE (field)))
+ continue;
else
{
HOST_WIDE_INT pos = int_byte_position (field);