diff mbox

[avr.applied] Fix PR81473: Don't use INT8_MIN etc.

Message ID cd0af2df-fcea-3a32-d085-c0b3f20b233d@gjlay.de
State New
Headers show

Commit Message

Georg-Johann Lay July 18, 2017, 9:44 a.m. UTC
https://gcc.gnu.org/r250301
https://gcc.gnu.org/r250302

Removed usage of INT8_MIN and friends as they are not available
in older C++ which leads to build failure.

Applied to trunk and v7 branch.

Johann


gcc/
	Backport from 2017-07-18 trunk r250301.
	PR target/81473
	* config/avr/avr.c (avr_optimize_casesi): Don't use
	INT8_MIN, INT8_MAX, UINT8_MAX, INT16_MIN, INT16_MAX, UINT16_MAX.
diff mbox

Patch

Index: config/avr/avr.c
===================================================================
--- config/avr/avr.c	(revision 250258)
+++ config/avr/avr.c	(working copy)
@@ -553,9 +553,9 @@  avr_optimize_casesi (rtx_insn *insns[6],
   HOST_WIDE_INT hig_idx = low_idx + num_idx;
 
   // Maximum ranges of (un)signed QImode resp. HImode.
-  int imin = QImode == mode ? INT8_MIN : INT16_MIN;
-  int imax = QImode == mode ? INT8_MAX : INT16_MAX;
-  unsigned umax = QImode == mode ? UINT8_MAX : UINT16_MAX;
+  unsigned umax = QImode == mode ? 0xff : 0xffff;
+  int imax = QImode == mode ? 0x7f : 0x7fff;
+  int imin = -imax - 1;
 
   // Testing the case range and whether it fits into the range of the
   // (un)signed mode.  This test should actually always pass because it