Commit aa256c4a by Marek Polacek Committed by Marek Polacek

c-common.c (warn_for_sign_compare): Cast to unsigned when shifting a negative value.

	* c-common.c (warn_for_sign_compare): Cast to unsigned when shifting
	a negative value.

	* c-typeck.c (set_nonincremental_init_from_string): Use
	HOST_WIDE_INT_M1U when shifting a negative value.

	* rtlanal.c (split_double): Cast to unsigned when shifting a negative
	value.
	* sched-int.h (UNKNOWN_DEP_COST): Likewise.

From-SVN: r227743
parent 0f876f22
2015-09-14 Marek Polacek <polacek@redhat.com>
* rtlanal.c (split_double): Cast to unsigned when shifting a negative
value.
* sched-int.h (UNKNOWN_DEP_COST): Likewise.
2015-09-11 Mark Wielaard <mjw@redhat.com> 2015-09-11 Mark Wielaard <mjw@redhat.com>
PR c/28901 PR c/28901
......
2015-09-14 Marek Polacek <polacek@redhat.com>
* c-common.c (warn_for_sign_compare): Cast to unsigned when shifting
a negative value.
2015-09-11 Mark Wielaard <mjw@redhat.com> 2015-09-11 Mark Wielaard <mjw@redhat.com>
PR c/28901 PR c/28901
......
...@@ -12142,7 +12142,7 @@ warn_for_sign_compare (location_t location, ...@@ -12142,7 +12142,7 @@ warn_for_sign_compare (location_t location,
if (bits < TYPE_PRECISION (result_type) if (bits < TYPE_PRECISION (result_type)
&& bits < HOST_BITS_PER_LONG && unsignedp) && bits < HOST_BITS_PER_LONG && unsignedp)
{ {
mask = (~ (HOST_WIDE_INT) 0) << bits; mask = (~ (unsigned HOST_WIDE_INT) 0) << bits;
if ((mask & constant) != mask) if ((mask & constant) != mask)
{ {
if (constant == 0) if (constant == 0)
......
2015-09-14 Marek Polacek <polacek@redhat.com>
* c-typeck.c (set_nonincremental_init_from_string): Use
HOST_WIDE_INT_M1U when shifting a negative value.
2015-09-09 Mark Wielaard <mjw@redhat.com> 2015-09-09 Mark Wielaard <mjw@redhat.com>
* c-typeck.c (build_binary_op): Check and warn when nonnull arg * c-typeck.c (build_binary_op): Check and warn when nonnull arg
......
...@@ -8276,7 +8276,7 @@ set_nonincremental_init_from_string (tree str, ...@@ -8276,7 +8276,7 @@ set_nonincremental_init_from_string (tree str,
{ {
if (val[0] & (((HOST_WIDE_INT) 1) << (bitpos - 1))) if (val[0] & (((HOST_WIDE_INT) 1) << (bitpos - 1)))
{ {
val[0] |= ((HOST_WIDE_INT) -1) << bitpos; val[0] |= HOST_WIDE_INT_M1U << bitpos;
val[1] = -1; val[1] = -1;
} }
} }
...@@ -8287,8 +8287,7 @@ set_nonincremental_init_from_string (tree str, ...@@ -8287,8 +8287,7 @@ set_nonincremental_init_from_string (tree str,
} }
else if (val[1] & (((HOST_WIDE_INT) 1) else if (val[1] & (((HOST_WIDE_INT) 1)
<< (bitpos - 1 - HOST_BITS_PER_WIDE_INT))) << (bitpos - 1 - HOST_BITS_PER_WIDE_INT)))
val[1] |= ((HOST_WIDE_INT) -1) val[1] |= HOST_WIDE_INT_M1U << (bitpos - HOST_BITS_PER_WIDE_INT);
<< (bitpos - HOST_BITS_PER_WIDE_INT);
} }
value = wide_int_to_tree (type, value = wide_int_to_tree (type,
......
...@@ -5805,9 +5805,9 @@ split_double (rtx value, rtx *first, rtx *second) ...@@ -5805,9 +5805,9 @@ split_double (rtx value, rtx *first, rtx *second)
if (BITS_PER_WORD < HOST_BITS_PER_LONG && BITS_PER_WORD == 32) if (BITS_PER_WORD < HOST_BITS_PER_LONG && BITS_PER_WORD == 32)
{ {
if (l[0] & ((long) 1 << 31)) if (l[0] & ((long) 1 << 31))
l[0] |= ((long) (-1) << 32); l[0] |= ((unsigned long) (-1) << 32);
if (l[1] & ((long) 1 << 31)) if (l[1] & ((long) 1 << 31))
l[1] |= ((long) (-1) << 32); l[1] |= ((unsigned long) (-1) << 32);
} }
#endif #endif
......
...@@ -240,7 +240,7 @@ struct _dep ...@@ -240,7 +240,7 @@ struct _dep
int cost:20; int cost:20;
}; };
#define UNKNOWN_DEP_COST (-1<<19) #define UNKNOWN_DEP_COST ((int) ((unsigned int) -1 << 19))
typedef struct _dep dep_def; typedef struct _dep dep_def;
typedef dep_def *dep_t; typedef dep_def *dep_t;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment