diff options
author | Jakub Jelinek <jakub@redhat.com> | 2014-03-22 15:03:20 +0100 |
---|---|---|
committer | Jakub Jelinek <jakub@gcc.gnu.org> | 2014-03-22 15:03:20 +0100 |
commit | 3db31fd1cc7acf87e092c0bbeba37d234c77b83b (patch) | |
tree | 676f740ed02f7c9e91151900c6be40fcc11bd38b | |
parent | 9e76922266203ac9f55c08ce2437e596108bb8af (diff) | |
download | gcc-3db31fd1cc7acf87e092c0bbeba37d234c77b83b.zip gcc-3db31fd1cc7acf87e092c0bbeba37d234c77b83b.tar.gz gcc-3db31fd1cc7acf87e092c0bbeba37d234c77b83b.tar.bz2 |
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
-rw-r--r-- | gcc/ChangeLog | 7 | ||||
-rw-r--r-- | gcc/genautomata.c | 2 | ||||
-rw-r--r-- | gcc/toplev.c | 2 |
3 files changed, 9 insertions, 2 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index ba74927..dbd4971 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -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 diff --git a/gcc/genautomata.c b/gcc/genautomata.c index 9db8615..0c61278 100644 --- a/gcc/genautomata.c +++ b/gcc/genautomata.c @@ -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; diff --git a/gcc/toplev.c b/gcc/toplev.c index c652522..0f7d452 100644 --- a/gcc/toplev.c +++ b/gcc/toplev.c @@ -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 { |