On Thursday 22 November 2007, Lucas Nussbaum wrote: > On 21/11/07 at 18:03 +0100, Martin Michlmayr wrote: > > * Frans Pop <[EMAIL PROTECTED]> [2007-11-21 17:47]: > > > The most effective/efficient way to do this may be an archive rebuild > > > with a modified gcc that emits a warning if this case is hit and then > > > check build logs for the warning. > > > > > > Something like the patch below (stolen from the thread on > > > linux-kernel). > > > > Sounds like something Lucas (CCed) could do. > > I'm currently in VAC. I could start a rebuild on monday if someone > provides patched gcc packages for i386 for me.
I have tried but get an error I don't understand when building gcc-4.2: [...] ranlib .libs/libgfortran.a creating libgfortran.la (cd .libs && rm -f libgfortran.la && ln -s ../libgfortran.la libgfortran.la) make[8]: Leaving directory `/tmp/buildd/gcc-4.2-4.2.2/build/i486-linux-gnu/64/libgfortran' make[7]: Leaving directory `/tmp/buildd/gcc-4.2-4.2.2/build/i486-linux-gnu/64/libgfortran' make[6]: Leaving directory `/tmp/buildd/gcc-4.2-4.2.2/build/i486-linux-gnu/libgfortran' make[5]: Leaving directory `/tmp/buildd/gcc-4.2-4.2.2/build/i486-linux-gnu/libgfortran' make[4]: Leaving directory `/tmp/buildd/gcc-4.2-4.2.2/build/i486-linux-gnu/libgfortran' make[3]: Leaving directory `/tmp/buildd/gcc-4.2-4.2.2/build' make[2]: *** [bootstrap-lean] Error 2 make[2]: Leaving directory `/tmp/buildd/gcc-4.2-4.2.2/build' s=`cat status`; rm -f status; test $s -eq 0 make[1]: *** [stamps/05-build-stamp] Error 1 make[1]: Leaving directory `/tmp/buildd/gcc-4.2-4.2.2' make: *** [stamps/05-build-stamp] Error 2 dpkg-buildpackage: failure: debian/rules build gave error exit status 2 Attached the patch I used. I don't see how the patch could be related to the build failure. Tried the build both in a chroot and using pbuilder. Cheers, FJP
diff -u gcc-4.2-4.2.2/debian/rules.patch gcc-4.2-4.2.2/debian/rules.patch --- gcc-4.2-4.2.2/debian/rules.patch +++ gcc-4.2-4.2.2/debian/rules.patch @@ -78,6 +78,7 @@ m68k-symbolic-operand \ m68k-bitfield-offset \ mips-libspec \ + abs-miscompile-detect \ # svn-updates \ # classmap-path \ diff -u gcc-4.2-4.2.2/debian/changelog gcc-4.2-4.2.2/debian/changelog --- gcc-4.2-4.2.2/debian/changelog +++ gcc-4.2-4.2.2/debian/changelog @@ -1,3 +1,9 @@ +gcc-4.2 (4.2.2-4~abs) UNRELEASED; urgency=low + + * Detect miscompiled abs() functions. + + -- Frans Pop <[EMAIL PROTECTED]> Mon, 26 Nov 2007 02:56:26 +0100 + gcc-4.2 (4.2.2-3) unstable; urgency=low * Update to SVN 20071014 from the ubuntu/gcc-4_2-branch. only in patch2: unchanged: --- gcc-4.2-4.2.2.orig/debian/patches/abs-miscompile-detect.dpatch +++ gcc-4.2-4.2.2/debian/patches/abs-miscompile-detect.dpatch @@ -0,0 +1,37 @@ +#! /bin/sh -e + +# DP: enable biarch for 31 bit compiler + +dir= +if [ $# -eq 3 -a "$2" = '-d' ]; then + pdir="-d $3" + dir="$3/" +elif [ $# -ne 1 ]; then + echo >&2 "`basename $0`: script expects -patch|-unpatch as argument" + exit 1 +fi +case "$1" in + -patch) + patch $pdir -f --no-backup-if-mismatch -p0 < $0 + ;; + -unpatch) + patch $pdir -f --no-backup-if-mismatch -R -p0 < $0 + ;; + *) + echo >&2 "`basename $0`: script expects -patch|-unpatch as argument" + exit 1 +esac +exit 0 + +--- gcc/fold-const.c 2007/11/17 13:46:53 130257 ++++ gcc/fold-const.c 2007/11/17 14:22:42 130258 +@@ -5660,6 +5660,9 @@ + } + break; + } ++ /* If the constant is negative, we cannot simplify this. */ ++ if (tree_int_cst_sgn (c) == -1) ++ { warning(0, "Miscompiled abs() function detected!"); break; } + /* FALLTHROUGH */ + case NEGATE_EXPR: + if ((t1 = extract_muldiv (op0, c, code, wide_type, strict_overflow_p))
signature.asc
Description: This is a digitally signed message part.