summaryrefslogtreecommitdiff
path: root/nasm.c
diff options
context:
space:
mode:
authorH. Peter Anvin <hpa@zytor.com>2008-01-08 22:29:21 -0800
committerH. Peter Anvin <hpa@zytor.com>2008-01-08 22:29:21 -0800
commit62cf415f4976f681edecb067e9ca1c17f145a349 (patch)
tree0e7ea558edb0830926fe9c64fa090638507bda12 /nasm.c
parent72c64378909cf7d961d6fd7cad1adc77ce72507d (diff)
downloadnasm-62cf415f4976f681edecb067e9ca1c17f145a349.tar.gz
Optimizer: force progression through final passes when hitting limit
We have a number of bug reports about things not working properly when the optimizer is running out of passes. I suspect the reason is simply that we don't properly execute the final passes (pass0 = 1, 2) when hitting the limit. Make sure we advance pass0 the last few times.
Diffstat (limited to 'nasm.c')
-rw-r--r--nasm.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/nasm.c b/nasm.c
index b1c2239c..63aaeb14 100644
--- a/nasm.c
+++ b/nasm.c
@@ -910,7 +910,7 @@ static void assemble_file(char *fname)
pass_max = (optimizing > 0 ? optimizing : 0) + 2; /* passes 1, optimizing, then 2 */
pass0 = !(optimizing > 0); /* start at 1 if not optimizing */
- for (pass = 1; pass <= pass_max && pass0 <= 2; pass++) {
+ for (pass = 1; pass0 <= 2; pass++) {
int pass1, pass2;
ldfunc def_label;
@@ -1476,7 +1476,8 @@ static void assemble_file(char *fname)
exit(1);
}
pass_cnt++;
- if (pass > 1 && !global_offset_changed) {
+ if ((pass > 1 && !global_offset_changed) ||
+ pass >= pass_max - 2) {
pass0++;
if (pass0 == 2)
pass = pass_max - 1;