diff options
author | Richard Kenner <kenner@gcc.gnu.org> | 1995-06-09 18:01:39 -0400 |
---|---|---|
committer | Richard Kenner <kenner@gcc.gnu.org> | 1995-06-09 18:01:39 -0400 |
commit | 138c94ea17d7d83587a3cac9978124967ba1b5b7 (patch) | |
tree | 6f8f2251be66a017c766a5276ea4d4438347fde3 /gcc/cexp.y | |
parent | 245391da4ed030a58f54ecd3ae1f9cbbd31c965b (diff) | |
download | gcc-138c94ea17d7d83587a3cac9978124967ba1b5b7.zip gcc-138c94ea17d7d83587a3cac9978124967ba1b5b7.tar.gz gcc-138c94ea17d7d83587a3cac9978124967ba1b5b7.tar.bz2 |
(left_shift): Ignore integer overflow.
From-SVN: r9915
Diffstat (limited to 'gcc/cexp.y')
-rw-r--r-- | gcc/cexp.y | 16 |
1 files changed, 5 insertions, 11 deletions
@@ -898,21 +898,15 @@ left_shift (a, b) struct constant *a; unsigned long b; { + /* It's unclear from the C standard whether shifts can overflow. + The following code ignores overflow; perhaps a C standard + interpretation ruling is needed. */ if (b >= HOST_BITS_PER_LONG) - { - if (! a->unsignedp && a->value != 0) - integer_overflow (); - return 0; - } + return 0; else if (a->unsignedp) return (unsigned long) a->value << b; else - { - long l = a->value << b; - if (l >> b != a->value) - integer_overflow (); - return l; - } + return a->value << b; } static long |