[gcc(refs/users/marxin/heads/if-to-switch-v2)] PR middle-end/90597: gcc_assert ICE in layout_type
Martin Liska
marxin@gcc.gnu.org
Tue Sep 1 11:50:40 GMT 2020
https://gcc.gnu.org/g:b61eaa25b0812a5996024e0ddb3535dde5a89c88
commit b61eaa25b0812a5996024e0ddb3535dde5a89c88
Author: Roger Sayle <roger@nextmovesoftware.com>
Date: Tue Sep 1 12:03:21 2020 +0100
PR middle-end/90597: gcc_assert ICE in layout_type
This patch fixes the default implementation of TARGET_VECTOR_ALIGNMENT,
known as default_vector_alignment, using the same logic as my earlier
nvptx patch, as the ICE caused by TYPE_SIZE(type) being zero during
error handling in gcc.dg/attr-vector_size.c is common among backends,
and is known in bugzilla as PR middle-end/90597, apparently a recent
regression.
2020-09-01 Roger Sayle <roger@nextmovesoftware.com>
gcc/ChangeLog:
PR middle-end/90597
* targhooks.c (default_vector_alignment): Return at least the
GET_MODE_ALIGNMENT for the type's mode.
Diff:
---
gcc/targhooks.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/gcc/targhooks.c b/gcc/targhooks.c
index 0113c7b0ce2..da4805d284e 100644
--- a/gcc/targhooks.c
+++ b/gcc/targhooks.c
@@ -1233,8 +1233,9 @@ default_vector_alignment (const_tree type)
tree size = TYPE_SIZE (type);
if (tree_fits_uhwi_p (size))
align = tree_to_uhwi (size);
-
- return align < MAX_OFILE_ALIGNMENT ? align : MAX_OFILE_ALIGNMENT;
+ if (align >= MAX_OFILE_ALIGNMENT)
+ return MAX_OFILE_ALIGNMENT;
+ return MAX (align, GET_MODE_ALIGNMENT (TYPE_MODE (type)));
}
/* The default implementation of
More information about the Gcc-cvs
mailing list