decl alignment not respected
commit90a7a40b65d1057bff07961dd9c8b0c05c345ba8
authorAlan Modra <amodra@gmail.com>
Wed, 2 Mar 2016 14:05:21 +0000 (3 00:35 +1030)
committerAlan Modra <amodra@gcc.gnu.org>
Wed, 2 Mar 2016 14:05:21 +0000 (3 00:35 +1030)
tree215bc42509d8654673447e88532ee1fb0a10bcf3
parentde752fb0d2d3e27407ea5735604577d5aa76bcac
decl alignment not respected

This patch cures a problem with ICF of read-only variables at the
intersection of -fsection-anchors, -ftree-loop-vectorize, and targets
with alignment restrictions.

What happens with the testcase is:
- "c" is referenced in a constructor, thus make_decl_rtl for "c",
- make_decl_rtl puts "c" in an anchor block (-fsection-anchors),
- anchor block contents can't move, so "c" alignment can't change by
  ipa_increase_alignment (-ftree-loop-vectorize),
- however "a" alignment can be increased,
- ICF aliases "a" to "c".
So we have a decl for "a" saying it is aligned to 128 bits, using mem
for "c" which is only 16 bit aligned.

PR ipa/69990
gcc/
* ipa-icf.c (sem_variable::merge): Do not merge an alias with
larger alignment.
gcc/testsuite/
gcc.dg/pr69990.c: New.

From-SVN: r233906
gcc/ChangeLog
gcc/ipa-icf.c
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.dg/pr69990.c [new file with mode: 0644]