[PATCH] lra: fix FPE when dumping

Ilya Leoshkevich iii@linux.ibm.com
Tue Aug 14 07:43:00 GMT 2018


The following S/390 code

    struct {} b;
    void c() {
      __asm__("la 0,%0\n"
              "la 1,%1\n"
              :
              : "m" (b), "m" (b)
              : "r0", "r1", "r2", "r3", "r4", "r5", "r6", "r7", "r8",
                "r9", "r10", "r12", "r14");
    }

results in

    internal compiler error: Floating point exception

when building with

    -fira-verbose=9 -fdump-rtl-all

gcc/ChangeLog:

2018-07-25  Ilya Leoshkevich  <iii@linux.ibm.com>

        PR target/86547
	* lra-lives.c (remove_some_program_points_and_update_live_ranges):
        Check whether lra_live_max_point is 0 before dividing.
---
 gcc/lra-lives.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/gcc/lra-lives.c b/gcc/lra-lives.c
index 433c819d9e3..565c68b430a 100644
--- a/gcc/lra-lives.c
+++ b/gcc/lra-lives.c
@@ -1153,7 +1153,8 @@ remove_some_program_points_and_update_live_ranges (void)
   n++;
   if (lra_dump_file != NULL)
     fprintf (lra_dump_file, "Compressing live ranges: from %d to %d - %d%%\n",
-	     lra_live_max_point, n, 100 * n / lra_live_max_point);
+	     lra_live_max_point, n,
+	     lra_live_max_point ? 100 * n / lra_live_max_point : 100);
   if (n < lra_live_max_point)
     {
       lra_live_max_point = n;
-- 
2.18.0



More information about the Gcc-patches mailing list