https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109031
--- Comment #10 from Martin Liška <marxin at gcc dot gnu.org> --- (In reply to David Binderman from comment #9) > (In reply to Martin Liška from comment #8) > > > but then if diff returns 1, the script should return 0 and > > > if diff returns 0, then the script should return 1. > > > > You can take an inspiration here: > > https://github.com/marxin/gcc-util/blob/master/bisect/reduce.sh > > Thanks for that. I am a bit further forward and I have this cvise > script: > > /usr/bin/gcc -w -Werror=implicit bug892.c -o one.exe > && (./one.exe 1 | fgrep "checksum after hashing g_50 :" > 1) > && /home/dcb36/gcc/results/bin/gcc -w -O2 -fno-strict-aliasing bug892.c > -o two.exe If the compilation fails for any reason, then the compound && expression is false (non-zero) and thus you end up with 'exit 0'. That's not what you want I guess. What about: /usr/bin/gcc -w -Werror=implicit bug892.c -o one.exe && (./one.exe 1 | fgrep "checksum after hashing g_50 :" > 1) && /home/dcb36/gcc/results/bin/gcc -w -O2 -fno-strict-aliasing bug892.c -o two.exe && (./two.exe 1 | fgrep "checksum after hashing g_50 :" > 2) if test $? != 0; then exit 1 diff 1 2; if test $? = 0; then exit 1 fi exit 0 ? > && (./two.exe 1 | fgrep "checksum after hashing g_50 :" > 2) > && diff 1 2; > if test $? = 0; then > exit 1 > fi > exit 0 > > It still doesn't work right and I can't fathom what's wrong. > It all works nicely when I do it line by line.