Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 1 Jun 2014 11:25:34 +0000 (UTC)
From:      Jilles Tjoelker <jilles@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r266947 - head/bin/sh
Message-ID:  <201406011125.s51BPYxp011152@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
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:



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201406011125.s51BPYxp011152>