diff options
author | kenner <kenner@138bc75d-0d04-0410-961f-82ee72b054a4> | 1995-06-09 22:01:39 +0000 |
---|---|---|
committer | kenner <kenner@138bc75d-0d04-0410-961f-82ee72b054a4> | 1995-06-09 22:01:39 +0000 |
commit | e2e5cfe9124eb4a362d942f947a71be2c3efd530 (patch) | |
tree | 6f8f2251be66a017c766a5276ea4d4438347fde3 /gcc/cexp.y | |
parent | 2aa6a42944c10dbc0e176f587da5628974d48f66 (diff) | |
download | gcc-e2e5cfe9124eb4a362d942f947a71be2c3efd530.tar.gz |
(left_shift): Ignore integer overflow.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@9915 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/cexp.y')
-rw-r--r-- | gcc/cexp.y | 16 |
1 files changed, 5 insertions, 11 deletions
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 |