Hello,
This patch fixes label alignments after a ADDR_DIFF_VEC with byte
offsets. The bug occurs with building the libgcc for a sh-elf target.
See a reduced case here. The funny thing is that the assembly error
given in Subject appears only on a debug section when compiled with -g,
thus the emitted code without -g:
.align 2
.L4:
.byte .L3-.L5
.byte .L10-.L5
.byte .L7-.L5
.byte .L8-.L5
.byte .L9-.L5
.L3:
mov.l .L13,r1
assembles silently, although unaligned...
OK for trunk ? The failure occurs with the libgcc, so tested by allowing
the sh-elf build to complete.
Thanks,
Christian
2013-04-09 Christian Bruel
* config/sh/sh.md (barrier_align): Use next/prev_active_insn instead
of next/prev_real_insn.
Index: gcc/config/sh/sh.c
===
--- gcc/config/sh/sh.c (revision 197633)
+++ gcc/config/sh/sh.c (working copy)
@@ -5842,7 +5842,7 @@ fixup_addr_diff_vecs (rtx first)
int
barrier_align (rtx barrier_or_label)
{
- rtx next = next_real_insn (barrier_or_label), pat, prev;
+ rtx next = next_active_insn (barrier_or_label), pat, prev;
if (! next)
return 0;
@@ -5856,7 +5856,7 @@ barrier_align (rtx barrier_or_label)
/* This is a barrier in front of a constant table. */
return 0;
- prev = prev_real_insn (barrier_or_label);
+ prev = prev_active_insn (barrier_or_label);
if (GET_CODE (PATTERN (prev)) == ADDR_DIFF_VEC)
{
pat = PATTERN (prev);
int a;
int
foo (int sw)
{
int r=0;
switch (sw)
{
case 1:
r=a;
break;
case 2:
r=2;
break;
case 3:
r=3;
break;
case 4:
r=4;
break;
case 5:
r=5;
break;
}
return r;
}