toplev.c (init_local_tick): Avoid signed integer multiplication overflow.

* toplev.c (init_local_tick): Avoid signed integer multiplication
	overflow.
	* genautomata.c (reserv_sets_hash_value): Fix rotate idiom, avoid
	shift by first operand's bitsize.

From-SVN: r208765
This commit is contained in:
Jakub Jelinek 2014-03-22 15:03:20 +01:00 committed by Jakub Jelinek
parent 9e76922266
commit 3db31fd1cc
3 changed files with 9 additions and 2 deletions

View File

@ -1,3 +1,10 @@
2014-03-22 Jakub Jelinek <jakub@redhat.com>
* toplev.c (init_local_tick): Avoid signed integer multiplication
overflow.
* genautomata.c (reserv_sets_hash_value): Fix rotate idiom, avoid
shift by first operand's bitsize.
2014-03-21 Jakub Jelinek <jakub@redhat.com>
PR target/60610

View File

@ -3494,7 +3494,7 @@ reserv_sets_hash_value (reserv_sets_t reservs)
{
reservs_num--;
hash_value += ((*reserv_ptr >> i)
| (*reserv_ptr << ((sizeof (set_el_t) * CHAR_BIT) & -i)));
| (*reserv_ptr << (((sizeof (set_el_t) * CHAR_BIT) - 1) & -i)));
i++;
if (i == sizeof (set_el_t) * CHAR_BIT)
i = 0;

View File

@ -261,7 +261,7 @@ init_local_tick (void)
struct timeval tv;
gettimeofday (&tv, NULL);
local_tick = tv.tv_sec * 1000 + tv.tv_usec / 1000;
local_tick = (unsigned) tv.tv_sec * 1000 + tv.tv_usec / 1000;
}
#else
{