https://gcc.gnu.org/bugzilla/show_bug.cgi?id=69990
--- Comment #6 from Alan Modra <amodra at gcc dot gnu.org> --- Author: amodra Date: Wed Mar 2 14:05:21 2016 New Revision: 233906 URL: https://gcc.gnu.org/viewcvs?rev=233906&root=gcc&view=rev Log: 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. Added: trunk/gcc/testsuite/gcc.dg/pr69990.c Modified: trunk/gcc/ChangeLog trunk/gcc/ipa-icf.c trunk/gcc/testsuite/ChangeLog