From 1aa6caa36ca0c0202b4645c57e4d10c03de068f3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Th=C3=A9ophile=20Bastian?= Date: Fri, 5 Jul 2019 17:14:22 +0200 Subject: [PATCH] csmith check: pyramid: tolerate 1st row address The first row of a pyramid can have a larger location delta than the following, because there can be other things than a push between the function entry point and the first push --- csmith/check_generated_eh_frame.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/csmith/check_generated_eh_frame.py b/csmith/check_generated_eh_frame.py index 52ce672..a586385 100755 --- a/csmith/check_generated_eh_frame.py +++ b/csmith/check_generated_eh_frame.py @@ -59,7 +59,7 @@ def detect_clang_flat_to_pyramid(rows): [k'; k[ """ - def is_flatness_row(row, prev_cfa, prev_loc): + def is_flatness_row(row, prev_cfa, prev_loc, first_row=False): for reg in row: if reg not in ["LOC", "CFA", "ra"] and row[reg] != "u": return prev_cfa, prev_loc, True @@ -71,7 +71,7 @@ def detect_clang_flat_to_pyramid(rows): return prev_cfa, prev_loc, True prev_cfa += 8 loc = row["LOC"] - if loc > prev_loc + 2: + if not first_row and loc > prev_loc + 2: return prev_cfa, prev_loc, True prev_loc = loc @@ -87,9 +87,13 @@ def detect_clang_flat_to_pyramid(rows): first_cfa = int(rows[start_row]["CFA"][4:]) prev_cfa = first_cfa prev_loc = rows[start_row]["LOC"] + first_row = True for row in rows[start_row + 1 :]: - prev_cfa, prev_loc, flatness = is_flatness_row(row, prev_cfa, prev_loc) + prev_cfa, prev_loc, flatness = is_flatness_row( + row, prev_cfa, prev_loc, first_row + ) + first_row = False if flatness: break flatness_row_id += 1