aboutsummaryrefslogtreecommitdiff
path: root/gcc/ipa-inline-transform.c
diff options
context:
space:
mode:
authorMarek Polacek <polacek@redhat.com>2020-04-29 15:36:35 -0400
committerMarek Polacek <polacek@redhat.com>2020-04-30 08:34:40 -0400
commit6318fe77395fc0dd59419bc4d69cd06ac0158e54 (patch)
tree82957bc288e4f51774a1e62f8d862e33626d74ed /gcc/ipa-inline-transform.c
parentcd4b68527988f42c10c0d6c10e812d299887e0c2 (diff)
downloadgcc-6318fe77395fc0dd59419bc4d69cd06ac0158e54.zip
gcc-6318fe77395fc0dd59419bc4d69cd06ac0158e54.tar.gz
gcc-6318fe77395fc0dd59419bc4d69cd06ac0158e54.tar.bz2
tree: Don't reuse types if TYPE_USER_ALIGN differ [PR94775]
Here we trip on the TYPE_USER_ALIGN (t) assert in strip_typedefs: it gets "const d[0]" with TYPE_USER_ALIGN=0 but the result built by build_cplus_array_type is "const char[0]" with TYPE_USER_ALIGN=1. When we strip_typedefs the element of the array "const d", we see it's a typedef_variant_p, so we look at its DECL_ORIGINAL_TYPE, which is char, but we need to add the const qualifier, so we call cp_build_qualified_type -> build_qualified_type where get_qualified_type checks to see if we already have such a type by walking the variants list, which in this case is: char -> c -> const char -> const char -> d -> const d Because check_base_type only checks TYPE_ALIGN and not TYPE_USER_ALIGN, we choose the first const char, which has TYPE_USER_ALIGN set. If the element type of an array has TYPE_USER_ALIGN, the array type gets it too. So we can make check_base_type stricter. I was afraid that it might make us reuse types less often, but measuring showed that we build the same amount of types with and without the patch, while bootstrapping. PR c++/94775 * tree.c (check_base_type): Return true only if TYPE_USER_ALIGN match. (check_aligned_type): Check if TYPE_USER_ALIGN match. * g++.dg/warn/Warray-bounds-10.C: New test.
Diffstat (limited to 'gcc/ipa-inline-transform.c')
0 files changed, 0 insertions, 0 deletions