[Cryptominisat-devel] I need a bit of help debuggingCryptoMiniSat

Mate Soos soos.mate at gmail.com
Mer 19 Jan 23:31:59 CET 2011


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hi Vegard,

On 01/19/2011 10:42 PM, Vegard Nossum wrote:
> On 19 January 2011 21:24, Martin Maurer <meinemailingliste at online.de>
> wrote:
>> just some comments, don't know if relevant:
>> 
>>> Lit(int var, bool sign): x(var + var + (int) sign) { }
>> 
>> I think bool must not be 0 and 1, but 0 and not zero (every value
>> beside 0). So could it be that sign has values outside 0 and 1 ?
>> 
>>> int var() const { return x & 1; }
>> 
>>> bool sign() const { return x >> 1; }
>> 
>> In sign() i get a warning (/W3) with MSVC telling cast is needed
>> from x to bool. Perhaps add one ? Perhaps change to real if
>> statement and return to true and false.
>> 
>> Are these both function also like this in reality ? sign is shifted
>> right by 1, so a lot of bits used just for sign. And return value
>> of var() can only be 0 and 1. But perhaps it was written down only
>> to get it compiling, no real implementation... ?
> 
> Heh, you're right, I actually swapped the implementations of var()
> and sign(). But no matter, it apparently didn't make a difference for
> the example.

Yes, Martin was right here, and I have corrected it too, but to no
avail, as Vegard has noted it.

> Meanwhile, I asked the gcc guys on IRC -- they were able to produce
> an even further simplification of the code:
> 
> [..]

Nice :)

> 
> ...and they seem to think it's a bug as well. This test-case 
> apparently fails for 4.5 but works in 4.4 and trunk. Which means it 
> may be fixed in the latest version (not released), but they would
> like to file it as a bug anyway (somebody's on it).
> 
> Compiler bugs are nasty!

Indeed. We have collectively spent lots of time on this, so they are
expensive, too :O

Actually, I have posted this to gcc-help just half an hour ago, and the
impression was also that this is a bug. Apparently, pre-4.6.0 compiles
my version of the code[1] fine, but that's no guarantee by all means
that the bug in gcc is fixed (as mentioned by Vegard). I am, by the way,
very happy that we have managed to nail down a possible gcc bug, it was
great working with all of you!

Now that we know we are not responsible, a workaround needs to be
thought up, as most people will not compile a new gcc for CryptoMS :). I
think a version of the assert() I have mentioned will work fine, but I
need to use release_assert() so that the assert stays in case NDEBUG is
defined (i.e. for "Release" version of compilation). What do you think?

Bests,

Mate

[1] http://planete.inrialpes.fr/~soos/gcc/Main.cpp

- -- 
Mate Soos
Security Research Labs
http://www.srlabs.de
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.10 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAk03Zl8ACgkQsTOOstKb0jlcrQCbBh8wx/NgNlk7JMVf56+02+Sz
WZgAn3f3htUh4cl+z9XFmYjgfbCIqf/1
=SOpm
-----END PGP SIGNATURE-----



More information about the Cryptominisat-devel mailing list