Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/external/gpl3/gcc/dist/gcc Avoid undefined behaviour (which ...



details:   https://anonhg.NetBSD.org/src/rev/87f358a6ce38
branches:  trunk
changeset: 327973:87f358a6ce38
user:      martin <martin%NetBSD.org@localhost>
date:      Sat Mar 22 20:36:45 2014 +0000

description:
Avoid undefined behaviour (which causes traps on VAX).

diffstat:

 external/gpl3/gcc/dist/gcc/dse.c |  3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)

diffs (13 lines):

diff -r 113dd088bad1 -r 87f358a6ce38 external/gpl3/gcc/dist/gcc/dse.c
--- a/external/gpl3/gcc/dist/gcc/dse.c  Sat Mar 22 20:07:05 2014 +0000
+++ b/external/gpl3/gcc/dist/gcc/dse.c  Sat Mar 22 20:36:45 2014 +0000
@@ -290,6 +290,9 @@
 lowpart_bitmask (int n)
 {
   unsigned HOST_WIDE_INT mask = ~(unsigned HOST_WIDE_INT) 0;
+  gcc_assert(n >= 0 && n <= HOST_BITS_PER_WIDE_INT);
+  if (n == 0)
+    return 0;
   return mask >> (HOST_BITS_PER_WIDE_INT - n);
 }
 



Home | Main Index | Thread Index | Old Index