We're seeing some failures due to the local-alignment pass.  For example on sh4:

Tests that now fail, but worked before (16 tests):

gcc.dg/pr48335-1.c (test for excess errors)
gcc.dg/pr48335-2.c (test for excess errors)
gcc.dg/pr48335-5.c (test for excess errors)
gcc.dg/pr48335-6.c (test for excess errors)
gcc.dg/torture/pr48493.c   -O0  (test for excess errors)
gcc.dg/torture/pr48493.c   -O0  (test for excess errors)
gcc.dg/torture/pr48493.c   -O1  (test for excess errors)
gcc.dg/torture/pr48493.c   -O1  (test for excess errors)
gcc.dg/torture/pr48493.c   -O2  (test for excess errors)
gcc.dg/torture/pr48493.c   -O2  (test for excess errors)
gcc.dg/torture/pr48493.c   -O2 -flto -fno-use-linker-plugin -flto-
partition=none  (test for excess errors)
gcc.dg/torture/pr48493.c   -O2 -flto -fno-use-linker-plugin -flto-
partition=none  (test for excess errors)
gcc.dg/torture/pr48493.c   -O3 -g  (test for excess errors)
gcc.dg/torture/pr48493.c   -O3 -g  (test for excess errors)
gcc.dg/torture/pr48493.c   -Os  (test for excess errors)
gcc.dg/torture/pr48493.c   -Os  (test for excess errors)

Or on x86_64:

during GIMPLE pass: adjust_alignment
/home/jenkins/linux/arch/x86/boot/string.c: In function ‘simple_strtoull’:
/home/jenkins/linux/arch/x86/boot/string.c:121:20: internal compiler error: in
execute, at adjust-alignment.c:74
  121 | unsigned long long simple_strtoull(const char *cp, char **endp, unsigned
int base)
      |                    ^~~~~~~~~~~~~~~
0x79c5b3 execute
        ../../../../../gcc/gcc/adjust-alignment.c:74
Please submit a full bug report,

There may be others, I haven't searched the failing targets extensively for this
issue. 

AFAICT the adjust-alignment pass is supposed to increase alignments of locals
when needed.  It has an assert to ensure that alignments are only increased.

However, if the object was declared with an alignment attribute that is larger
than what LOCAL_ALIGNMENT would produce for the object, then the 
adjust-alignment 
pass trips the assert.

Rather than asserting, just ignoring such objects seems better.  But I'm not
intimately familiar with the issues here.

Bootstrapped and regression tested on x86_64, also verified this fixes the sh4
issue.  All the *-elf targets have also built/tested with this patch with no
regressions.

OK for the trunk?

Jeff


diff --git a/gcc/adjust-alignment.c b/gcc/adjust-alignment.c
index 9b797386bf8..523216a8fcf 100644
--- a/gcc/adjust-alignment.c
+++ b/gcc/adjust-alignment.c
@@ -71,7 +71,8 @@ pass_adjust_alignment::execute (function *fun)
       unsigned align = LOCAL_DECL_ALIGNMENT (var);
 
       /* Make sure alignment only increase.  */
-      gcc_assert (align >= DECL_ALIGN (var));
+      if (DECL_ALIGN (var) >= align)
+	continue;
 
       SET_DECL_ALIGN (var, align);
     }

Reply via email to