This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
final.c: Set INSN_ADDRESSES (uid) to be aligned
- To: gcc-patches at gcc dot gnu dot org
- Subject: final.c: Set INSN_ADDRESSES (uid) to be aligned
- From: NIIBE Yutaka <gniibe at m17n dot org>
- Date: Tue, 30 Oct 2001 14:13:30 +0900 (JST)
Please review following patch and apply it if it's good.
This patch is same one (just re-diffed) in (related to PR c/4516):
http://gcc.gnu.org/ml/gcc-patches/2001-10/msg00664.html
In shorten_branches of final.c, INSN_ADDRESSES (uid) will have
wrong value for CODE_LABEL. This patch fixes it.
2001-10-30 NIIBE Yutaka <gniibe@m17n.org>
* final.c (shorten_branches): For CODE_LABEL, set
insn_current_address to be aligned, so that
INSN_ADDRESSES (uid) has correct value.
Increment insn_current_address inside the loop.
Index: gcc/final.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/final.c,v
retrieving revision 1.214
diff -c -3 -p -r1.214 final.c
*** gcc/final.c 2001/10/28 12:42:02 1.214
--- gcc/final.c 2001/10/29 23:57:09
*************** shorten_branches (first)
*** 1277,1283 ****
/* Compute initial lengths, addresses, and varying flags for each insn. */
for (insn_current_address = FIRST_INSN_ADDRESS, insn = first;
insn != 0;
! insn_current_address += insn_lengths[uid], insn = NEXT_INSN (insn))
{
uid = INSN_UID (insn);
--- 1277,1283 ----
/* Compute initial lengths, addresses, and varying flags for each insn. */
for (insn_current_address = FIRST_INSN_ADDRESS, insn = first;
insn != 0;
! insn = NEXT_INSN (insn))
{
uid = INSN_UID (insn);
*************** shorten_branches (first)
*** 1291,1296 ****
--- 1291,1297 ----
int align = 1 << log;
int new_address = (insn_current_address + align - 1) & -align;
insn_lengths[uid] = new_address - insn_current_address;
+ insn_current_address = new_address;
}
}
*************** shorten_branches (first)
*** 1370,1375 ****
--- 1371,1378 ----
if (insn_lengths[uid] < 0)
fatal_insn ("Negative insn length", insn);
#endif
+
+ insn_current_address += insn_lengths[uid];
}
/* Now loop over all the insns finding varying length insns. For each,
--