From 37934a07cfb28b3c7bcf818e9cbce586918a0abd Mon Sep 17 00:00:00 2001 From: tg Date: Fri, 10 Oct 2008 21:30:43 +0000 Subject: [PATCH] fix prodded by cnuke@ for AIX with IBM xlC 7.0: fool the compiler into not doing static bounds checking when we do one-past-the-array-boundary pointer assignments for cases where the only accesses are like (*--pointer); bump version --- check.t | 4 ++-- lex.c | 4 ++-- sh.h | 4 ++-- shf.c | 6 +++--- syn.c | 4 ++-- 5 files changed, 11 insertions(+), 11 deletions(-) diff --git a/check.t b/check.t index d98415a..4dc0015 100644 --- a/check.t +++ b/check.t @@ -1,4 +1,4 @@ -# $MirOS: src/bin/mksh/check.t,v 1.228 2008/10/05 16:06:42 tg Exp $ +# $MirOS: src/bin/mksh/check.t,v 1.229 2008/10/10 21:30:41 tg Exp $ # $OpenBSD: bksl-nl.t,v 1.2 2001/01/28 23:04:56 niklas Exp $ # $OpenBSD: history.t,v 1.5 2001/01/28 23:04:56 niklas Exp $ # $OpenBSD: read.t,v 1.3 2003/03/10 03:48:16 david Exp $ @@ -7,7 +7,7 @@ # http://www.research.att.com/~gsf/public/ifs.sh expected-stdout: - @(#)MIRBSD KSH R35 2008/10/05 + @(#)MIRBSD KSH R35 2008/10/10 description: Check version of shell. stdin: diff --git a/lex.c b/lex.c index f918189..bbc8a4e 100644 --- a/lex.c +++ b/lex.c @@ -2,7 +2,7 @@ #include "sh.h" -__RCSID("$MirOS: src/bin/mksh/lex.c,v 1.72 2008/09/30 19:35:10 tg Exp $"); +__RCSID("$MirOS: src/bin/mksh/lex.c,v 1.73 2008/10/10 21:30:42 tg Exp $"); /* * states while lexing word @@ -151,7 +151,7 @@ yylex(int cf) states[0].ls_info.base = NULL; statep = &states[1]; state_info.base = states; - state_info.end = &states[STATE_BSIZE]; + state_info.end = &state_info.base[STATE_BSIZE]; Xinit(ws, wp, 64, ATEMP); diff --git a/sh.h b/sh.h index ade9a4c..9ddd668 100644 --- a/sh.h +++ b/sh.h @@ -100,9 +100,9 @@ #define __SCCSID(x) __IDSTRING(sccsid,x) #ifdef EXTERN -__RCSID("$MirOS: src/bin/mksh/sh.h,v 1.238 2008/10/05 16:06:43 tg Exp $"); +__RCSID("$MirOS: src/bin/mksh/sh.h,v 1.239 2008/10/10 21:30:42 tg Exp $"); #endif -#define MKSH_VERSION "R35 2008/10/05" +#define MKSH_VERSION "R35 2008/10/10" #ifndef MKSH_INCLUDES_ONLY diff --git a/shf.c b/shf.c index 442ec08..3dce4bd 100644 --- a/shf.c +++ b/shf.c @@ -2,7 +2,7 @@ #include "sh.h" -__RCSID("$MirOS: src/bin/mksh/shf.c,v 1.21 2008/05/17 18:47:02 tg Exp $"); +__RCSID("$MirOS: src/bin/mksh/shf.c,v 1.22 2008/10/10 21:30:43 tg Exp $"); /* flags to shf_emptybuf() */ #define EB_READSW 0x01 /* about to switch to reading */ @@ -835,7 +835,7 @@ shf_vfprintf(struct shf *shf, const char *fmt, va_list args) case 'u': case 'x': flags |= FL_NUMBER; - cp = &numbuf[sizeof (numbuf)]; + cp = numbuf + sizeof (numbuf); /*- * XXX any better way to do this? * XXX hopefully the compiler optimises this out @@ -903,7 +903,7 @@ shf_vfprintf(struct shf *shf, const char *fmt, va_list args) } } } - len = &numbuf[sizeof (numbuf)] - (s = cp); + len = numbuf + sizeof (numbuf) - (s = cp); if (flags & FL_DOT) { if (precision > len) { field = precision; diff --git a/syn.c b/syn.c index 004f3db..2beffe2 100644 --- a/syn.c +++ b/syn.c @@ -2,7 +2,7 @@ #include "sh.h" -__RCSID("$MirOS: src/bin/mksh/syn.c,v 1.26 2008/08/02 17:45:12 tg Exp $"); +__RCSID("$MirOS: src/bin/mksh/syn.c,v 1.27 2008/10/10 21:30:43 tg Exp $"); struct nesting_state { int start_token; /* token than began nesting (eg, FOR) */ @@ -163,7 +163,7 @@ synio(int cf) iop->delim = yylval.cp; if (*ident != 0) /* unquoted */ iop->flag |= IOEVAL; - if (herep >= &heres[HERES]) + if (herep > &heres[HERES - 1]) yyerror("too many <