From: Richard Kenner Date: Fri, 9 Jun 1995 22:01:39 +0000 (-0400) Subject: (left_shift): Ignore integer overflow. X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=138c94ea17d7d83587a3cac9978124967ba1b5b7;p=gcc.git (left_shift): Ignore integer overflow. From-SVN: r9915 --- diff --git a/gcc/cexp.y b/gcc/cexp.y index 6082fecbedd..79282b756e0 100644 --- a/gcc/cexp.y +++ b/gcc/cexp.y @@ -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