diff options
author | Andreas Krebbel <krebbel@linux.ibm.com> | 2019-11-05 13:21:06 +0000 |
---|---|---|
committer | Andreas Krebbel <krebbel@gcc.gnu.org> | 2019-11-05 13:21:06 +0000 |
commit | 76d8b4d1ada1d9a6c1408b9b94b0baa31d1f3c0c (patch) | |
tree | ccbc3d5d70700ffbe7109bb329ae1e69ca16ee40 | |
parent | 30f1f974b8c4eff694632331d66ff02c3c3404d3 (diff) | |
download | gcc-76d8b4d1ada1d9a6c1408b9b94b0baa31d1f3c0c.zip gcc-76d8b4d1ada1d9a6c1408b9b94b0baa31d1f3c0c.tar.gz gcc-76d8b4d1ada1d9a6c1408b9b94b0baa31d1f3c0c.tar.bz2 |
IBM Z: Use tree_fits_uhwi_p in vector_alignment hook
This fixes an ICE in gcc.dg/attr-vector_size.c testcase.
gcc/ChangeLog:
2019-11-05 Andreas Krebbel <krebbel@linux.ibm.com>
* config/s390/s390.c (s390_vector_alignment): Check if the value
fits into uhwi before using it.
From-SVN: r277829
-rw-r--r-- | gcc/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/config/s390/s390.c | 8 |
2 files changed, 12 insertions, 1 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index c281cc8..b3d97c2 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,8 @@ +2019-11-05 Andreas Krebbel <krebbel@linux.ibm.com> + + * config/s390/s390.c (s390_vector_alignment): Check if the value + fits into uhwi before using it. + 2019-11-05 Martin Liska <mliska@suse.cz> * symbol-summary.h: Use ggc_delete. diff --git a/gcc/config/s390/s390.c b/gcc/config/s390/s390.c index 151b80d..ff0b43c 100644 --- a/gcc/config/s390/s390.c +++ b/gcc/config/s390/s390.c @@ -16075,13 +16075,19 @@ s390_support_vector_misalignment (machine_mode mode ATTRIBUTE_UNUSED, static HOST_WIDE_INT s390_vector_alignment (const_tree type) { + tree size = TYPE_SIZE (type); + if (!TARGET_VX_ABI) return default_vector_alignment (type); if (TYPE_USER_ALIGN (type)) return TYPE_ALIGN (type); - return MIN (64, tree_to_shwi (TYPE_SIZE (type))); + if (tree_fits_uhwi_p (size) + && tree_to_uhwi (size) < BIGGEST_ALIGNMENT) + return tree_to_uhwi (size); + + return BIGGEST_ALIGNMENT; } /* Implement TARGET_CONSTANT_ALIGNMENT. Alignment on even addresses for |