diff mbox series

lra: fix FPE when dumping

Message ID 20180814074252.4849-1-iii@linux.ibm.com
State New
Headers show
Series lra: fix FPE when dumping | expand

Commit Message

Ilya Leoshkevich Aug. 14, 2018, 7:42 a.m. UTC
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(-)

Comments

Vladimir Makarov Aug. 14, 2018, 7:33 p.m. UTC | #1
On 08/14/2018 03:42 AM, Ilya Leoshkevich wrote:
> 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.
Sure, the patch is ok for me and for committing it into the trunk.

Thank you, Ilya.
Jeff Law Aug. 15, 2018, 4:12 a.m. UTC | #2
On 08/14/2018 01:33 PM, Vladimir Makarov wrote:
> On 08/14/2018 03:42 AM, Ilya Leoshkevich wrote:
>> 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.
> Sure, the patch is ok for me and for committing it into the trunk.
> 
> Thank you, Ilya.
Thanks.  Committed to the trunk.  Bug closed (since it looks like the
LRA loop has been fixed as well).


Jeff
diff mbox series

Patch

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;