From: Andreas Krebbel Date: Tue, 5 Nov 2019 15:24:43 +0000 (+0000) Subject: IBM Z: Use tree_fits_uhwi_p in vector_alignment hook X-Git-Tag: releases/gcc-9.3.0~429 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=05a649bbef409c1461ca1e17d6a23b9e290bac3e;p=thirdparty%2Fgcc.git 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 Backport from mainline 2019-11-05 Andreas Krebbel * config/s390/s390.c (s390_vector_alignment): Check if the value fits into uhwi before using it. From-SVN: r277841 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index b534127d2328..d84440809a70 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,11 @@ +2019-11-05 Andreas Krebbel + + Backport from mainline + 2019-11-05 Andreas Krebbel + + * config/s390/s390.c (s390_vector_alignment): Check if the value + fits into uhwi before using it. + 2019-11-01 John David Anglin Backport from mainline diff --git a/gcc/config/s390/s390.c b/gcc/config/s390/s390.c index 21aaae1fdbd6..081b67d8dab5 100644 --- a/gcc/config/s390/s390.c +++ b/gcc/config/s390/s390.c @@ -15974,13 +15974,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