diff mbox

Fix undefined behaviour in mips port

Message ID 56064B8B.5030305@redhat.com
State New
Headers show

Commit Message

Jeff Law Sept. 26, 2015, 7:38 a.m. UTC
Another instance of left shifting a negative value.  Fixed in an obvious 
way.  Verified all the mips configurations in config-list.mk build now 
using a trunk compiler.

Installed on the trunk,
Jeff
commit fff8087106b686a8c0ac6c7dab3dd7e12cd717ba
Author: Jeff Law <law@tor.usersys.redhat.com>
Date:   Sat Sep 26 03:24:00 2015 -0400

    [PATCH] Fix undefined behaviour in mips port
    	* config/mips/mips.c (mips_compute_frame_info): Fix left shift
    	undefined behaviour.

Comments

Matthew Fortune Sept. 26, 2015, 5:19 p.m. UTC | #1
Jeff Law <law@redhat.com> writes:
> Another instance of left shifting a negative value.  Fixed in an obvious

> way.  Verified all the mips configurations in config-list.mk build now

> using a trunk compiler.

> 

> Installed on the trunk,


Thanks Jeff.

Matthew
diff mbox

Patch

diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 98c1bd9..6887b14 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,5 +1,8 @@ 
 2015-09-26  Jeff Law  <law@redhat.com>
 
+	* config/mips/mips.c (mips_compute_frame_info): Fix left shift
+	undefined behaviour.
+
 	* config/cris/cris.md (asrandb): Fix left shift undefined
 	behaviour.
 	(asrandw): Likewise.
diff --git a/gcc/config/mips/mips.c b/gcc/config/mips/mips.c
index 0e0ecf2..456db08 100644
--- a/gcc/config/mips/mips.c
+++ b/gcc/config/mips/mips.c
@@ -10572,7 +10572,7 @@  mips_compute_frame_info (void)
       if (mips_save_reg_p (regno))
 	{
 	  frame->num_fp += MAX_FPRS_PER_FMT;
-	  frame->fmask |= ~(~0 << MAX_FPRS_PER_FMT) << (regno - FP_REG_FIRST);
+	  frame->fmask |= ~(~0U << MAX_FPRS_PER_FMT) << (regno - FP_REG_FIRST);
 	}
 
   /* Move above the FPR save area.  */