aboutsummaryrefslogtreecommitdiff
path: root/gcc/varasm.c
diff options
context:
space:
mode:
authorAndreas Krebbel <krebbel@linux.vnet.ibm.com>2016-12-22 14:50:29 +0000
committerAndreas Krebbel <krebbel@gcc.gnu.org>2016-12-22 14:50:29 +0000
commit8db9d05e0f0642262300e89585da7c2667928993 (patch)
treeb224567ef58decaaa51a7eba54c6eee97a6dd51a /gcc/varasm.c
parentcbbb9dabbb498b27ca4cf7337a7c8aa013498bb0 (diff)
downloadgcc-8db9d05e0f0642262300e89585da7c2667928993.zip
gcc-8db9d05e0f0642262300e89585da7c2667928993.tar.gz
gcc-8db9d05e0f0642262300e89585da7c2667928993.tar.bz2
varasm: Propagate litpool decl alignment to generated RTX.
When pushing a value into the literal pool the resulting decl might get a higher alignment than the original expression depending on how a target defines CONSTANT_ALIGNMENT. Generating an RTX for the constant pool access we currently use the alignment from the original expression. Changed with the attached patch. This fixes a GCC 6 regression for S/390. For arrays of string constants as in the attached testcase encode_section_info is not able to figure out that the constant pool slot is already properly aligned since the mem_align field in the rtx is not set properly. gcc/ChangeLog: 2016-12-22 Andreas Krebbel <krebbel@linux.vnet.ibm.com> * varasm.c (build_constant_desc): Use the alignment of the var decl instead of the original expression. gcc/testsuite/ChangeLog: 2016-12-22 Andreas Krebbel <krebbel@linux.vnet.ibm.com> * gcc.target/s390/litpool-str-1.c: New test. From-SVN: r243888
Diffstat (limited to 'gcc/varasm.c')
-rw-r--r--gcc/varasm.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/gcc/varasm.c b/gcc/varasm.c
index 5b15847..75d5ad6 100644
--- a/gcc/varasm.c
+++ b/gcc/varasm.c
@@ -3296,6 +3296,10 @@ build_constant_desc (tree exp)
set_mem_attributes (rtl, exp, 1);
set_mem_alias_set (rtl, 0);
+ /* Putting EXP into the literal pool might have imposed a different
+ alignment which should be visible in the RTX as well. */
+ set_mem_align (rtl, DECL_ALIGN (decl));
+
/* We cannot share RTX'es in pool entries.
Mark this piece of RTL as required for unsharing. */
RTX_FLAG (rtl, used) = 1;