check for -fno-tree-vrp (existence and if it is required to würg around a gcc 4.1.1 bug)

This commit is contained in:
tg 2007-03-10 18:51:59 +00:00
parent 377dbe464a
commit 219bc99362
1 changed files with 43 additions and 1 deletions

View File

@ -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"