Author: jilles
Date: Sun Jun  1 11:25:34 2014
New Revision: 266947
URL: http://svnweb.freebsd.org/changeset/base/266947

Log:
  sh: Avoid undefined behaviour shifting negative values left in arithmetic.
  
  With i386 base clang, arith_yacc.o remains unchanged.

Modified:
  head/bin/sh/arith_yacc.c

Modified: head/bin/sh/arith_yacc.c
==============================================================================
--- head/bin/sh/arith_yacc.c    Sun Jun  1 10:22:18 2014        (r266946)
+++ head/bin/sh/arith_yacc.c    Sun Jun  1 11:25:34 2014        (r266947)
@@ -139,7 +139,7 @@ static arith_t do_binop(int op, arith_t 
        case ARITH_SUB:
                return (uintmax_t)a - (uintmax_t)b;
        case ARITH_LSHIFT:
-               return a << b;
+               return (uintmax_t)a << b;
        case ARITH_RSHIFT:
                return a >> b;
        case ARITH_LT:
_______________________________________________
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"

Reply via email to