aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorJakub Jelinek <jakub@redhat.com>2014-01-17 15:45:34 +0100
committerJakub Jelinek <jakub@gcc.gnu.org>2014-01-17 15:45:34 +0100
commit88e18bd5cc520a945793b5cae2561ad3a70633f6 (patch)
tree778cb6f38e21d2902007986b0d7a7c949dca5586 /gcc
parentcc2b0e50e02c9425a5102972cd79d5ff79e838e9 (diff)
downloadgcc-88e18bd5cc520a945793b5cae2561ad3a70633f6.zip
gcc-88e18bd5cc520a945793b5cae2561ad3a70633f6.tar.gz
gcc-88e18bd5cc520a945793b5cae2561ad3a70633f6.tar.bz2
i386.c (ix86_data_alignment): For compatibility with (incorrect) GCC 4.8 and earlier alignment assumptions...
* config/i386/i386.c (ix86_data_alignment): For compatibility with (incorrect) GCC 4.8 and earlier alignment assumptions ensure we align decls to at least the GCC 4.8 used alignments. From-SVN: r206713
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ChangeLog4
-rw-r--r--gcc/config/i386/i386.c25
2 files changed, 24 insertions, 5 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index d583762..5440d44 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,5 +1,9 @@
2014-01-17 Jakub Jelinek <jakub@redhat.com>
+ * config/i386/i386.c (ix86_data_alignment): For compatibility with
+ (incorrect) GCC 4.8 and earlier alignment assumptions ensure we align
+ decls to at least the GCC 4.8 used alignments.
+
PR fortran/59440
* tree-nested.c (convert_nonlocal_reference_stmt,
convert_local_reference_stmt): For NAMELIST_DECLs in gimple_bind_vars
diff --git a/gcc/config/i386/i386.c b/gcc/config/i386/i386.c
index df408ae..d3e4d5f 100644
--- a/gcc/config/i386/i386.c
+++ b/gcc/config/i386/i386.c
@@ -26433,6 +26433,15 @@ ix86_constant_alignment (tree exp, int align)
int
ix86_data_alignment (tree type, int align, bool opt)
{
+ /* GCC 4.8 and earlier used to incorrectly assume this alignment even
+ for symbols from other compilation units or symbols that don't need
+ to bind locally. In order to preserve some ABI compatibility with
+ those compilers, ensure we don't decrease alignment from what we
+ used to assume. */
+
+ int max_align_compat
+ = optimize_size ? BITS_PER_WORD : MIN (256, MAX_OFILE_ALIGNMENT);
+
/* A data structure, equal or greater than the size of a cache line
(64 bytes in the Pentium 4 and other recent Intel processors, including
processors based on Intel Core microarchitecture) should be aligned
@@ -26447,11 +26456,17 @@ ix86_data_alignment (tree type, int align, bool opt)
if (opt
&& AGGREGATE_TYPE_P (type)
&& TYPE_SIZE (type)
- && TREE_CODE (TYPE_SIZE (type)) == INTEGER_CST
- && (TREE_INT_CST_LOW (TYPE_SIZE (type)) >= (unsigned) max_align
- || TREE_INT_CST_HIGH (TYPE_SIZE (type)))
- && align < max_align)
- align = max_align;
+ && TREE_CODE (TYPE_SIZE (type)) == INTEGER_CST)
+ {
+ if ((TREE_INT_CST_LOW (TYPE_SIZE (type)) >= (unsigned) max_align_compat
+ || TREE_INT_CST_HIGH (TYPE_SIZE (type)))
+ && align < max_align_compat)
+ align = max_align_compat;
+ if ((TREE_INT_CST_LOW (TYPE_SIZE (type)) >= (unsigned) max_align
+ || TREE_INT_CST_HIGH (TYPE_SIZE (type)))
+ && align < max_align)
+ align = max_align;
+ }
/* x86-64 ABI requires arrays greater than 16 bytes to be aligned
to 16byte boundary. */