From 219bc9936299d66767ce1d8124369b90fcb2a720 Mon Sep 17 00:00:00 2001 From: tg Date: Sat, 10 Mar 2007 18:51:59 +0000 Subject: [PATCH] =?UTF-8?q?check=20for=20-fno-tree-vrp=20(existence=20and?= =?UTF-8?q?=20if=20it=20is=20required=20to=20w=C3=BCrg=20around=20a=20gcc?= =?UTF-8?q?=204.1.1=20bug)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Build.sh | 44 +++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 43 insertions(+), 1 deletion(-) diff --git a/Build.sh b/Build.sh index 83394e8..7486c29 100644 --- a/Build.sh +++ b/Build.sh @@ -1,5 +1,5 @@ #!/bin/sh -# $MirOS: src/bin/mksh/Build.sh,v 1.164 2007/03/10 17:29:53 tg Exp $ +# $MirOS: src/bin/mksh/Build.sh,v 1.165 2007/03/10 18:51:59 tg Exp $ #- # Environment used: CC CFLAGS CPP CPPFLAGS LDFLAGS LIBS NOWARN NROFF TARGET_OS # CPPFLAGS recognised: MKSH_SMALL MKSH_ASSUME_UTF8 MKSH_NEED_MKNOD MKSH_NOPWNAM @@ -37,6 +37,7 @@ alln=0123456789 alls=______________________________________________________________ nl=' ' +tcbo=0 upper() { @@ -82,6 +83,7 @@ ac_testn() cat >scn.c eval 'v "$CC $CFLAGS $CPPFLAGS $LDFLAGS $NOWARN -I'\''$srcdir'\' \ 'scn.c $LIBS" 2>&'$h | sed 's/^/] /' + test x"$tcbo" = x"1" && return if test -f a.out || test -f a.exe; then eval HAVE_$fu=1 $e "$bi==> $fd...$ao ${ui}yes$ao" @@ -301,6 +303,46 @@ NOWARN=$save_NOWARN # i=`echo :"$CFLAGS" | sed 's/^://' | tr -c -d $alll$allu$alln-` test x"$i" = x"" && ac_flags 1 otwo "-O2" +ac_flags 0 fnotreevrp "-fno-tree-vrp" +if test 1 = $HAVE_CAN_FNOTREEVRP; then + tcbo=1 + ac_testn need_fnotreevrp '' "if -fno-tree-vrp is needed" <<-'EOF' + typedef unsigned size_t; + char *strncpy(char *, const char *, size_t); + char * + strncpy(char *d, const char *s, size_t n) + { + if (!d || !s) { + if (d) + *d = n; + return (d); + } + return (*d = 1, d); + } + int + main(void) + { + char a[] = "t"; + strncpy(a, (void *)0, 2); + return (*a); + } + EOF + tcbo=0 + f=a.exe + test -f $f || f=a.out + if test -f $f; then + ./$f >/dev/null 2>&1 + rv=$? + rs=no + else + rv=0 + rs="yes (assumed; cannot run ./$f)" + fi + test 1 = $rv && rs=yes + test 2 = $rv || CFLAGS="$CFLAGS -fno-tree-vrp" + $e "$bi==> $fd...$ao ${ui}$rs$ao" + rm -f scn.c a.out a.exe +fi ac_flags 1 fnostrictaliasing "-fno-strict-aliasing" ac_flags 1 fstackprotectorall "-fstack-protector-all" ac_flags 1 fwholepgm "-fwhole-program --combine"