Quuxplusone / LLVMBugzillaTest

0 stars 0 forks source link

Crypto++ validation test passes Panama tests at -O0 but fails at -O1, -O2, -O3 #7750

Open Quuxplusone opened 13 years ago

Quuxplusone commented 13 years ago
Bugzilla Link PR9524
Status REOPENED
Importance P normal
Reported by Marshall Clow (work) (mclow@qti.qualcomm.com)
Reported on 2011-03-21 13:30:31 -0700
Last modified on 2011-10-10 15:12:57 -0700
Version trunk
Hardware Macintosh MacOS X
CC dgregor@apple.com, efriedma@quicinc.com, llvm-bugs@lists.llvm.org, sanxiyn@gmail.com
Fixed by commit(s)
Attachments GNUmakefile (6296 bytes, application/octet-stream)
9524-mtc.cpp (1298 bytes, text/plain)
9524-v.txt (3116 bytes, text/plain)
9524.o (290108 bytes, application/x-object)
Blocks
Blocked by
See also
Created attachment 6352
Replacement Makefile (uses clang instead of gcc)

To reproduce:
1) Get crypto++ from here: "svn co
https://cryptopp.svn.sourceforge.net/svnroot/cryptopp/trunk/c5 cryptopp"
2) Replace GNUMakefile with one from this bug report.
-- edit the first line of GNUMakefile to set the optimization level that you
want.
3) make test
4) ./cryptest.exe v 53   # runs just the Panama tests

If you built with -O0, the tests will succeed.
If you built with -O[123], the tests will fail.

I am working on a reduced example, but I don't have one yet.
Quuxplusone commented 13 years ago

Attached GNUmakefile (6296 bytes, application/octet-stream): Replacement Makefile (uses clang instead of gcc)

Quuxplusone commented 13 years ago

Forgot to add - it is sufficient that the file 'panama.cpp' be compiled with -O0; all the other files can be compiled with higher optimization levels, and the tests will still pass.

Quuxplusone commented 13 years ago

Even a not-so-reduced example that's a single file which can be compiled/run would be nice.

Please include the output of clang -v.

Quuxplusone commented 13 years ago
Hi Marshall,

I know you just *love* digging into Crypto++, but this bug report isn't
actionable as is, please reduce a testcase.  Thanks!
Quuxplusone commented 13 years ago

Attached 9524-mtc.cpp (1298 bytes, text/plain): Small program demonstrating the problem

Quuxplusone commented 13 years ago
Ok, here's a smaller test case.

To reproduce:
1) Build the cryptoPP library using the modified makefile that I originally
attached.
2) Build this program thusly:
    clang++ 9524-mtc.cpp cryptopp/panama.cpp -DCRYPTOPP_DISABLE_ASM -I cryptopp cryptopp/libcryptopp.a -o 9524-mtc
3) Run it, and see no output. ;-)
4) Build again at -O2
    clang++ 9524-mtc.cpp cryptopp/panama.cpp -DCRYPTOPP_DISABLE_ASM -I cryptopp cryptopp/libcryptopp.a -O2 -o 9524-mtc
5) Run again, and see failures.
$ ./9524-mtc
Digest test failed!
Expected: AA0CC954D757D7AC7779CA3342334CA471ABD47D5952AC91ED837ECD5B16922B
Got:      44EA5D0D580269214377E9DD29200B881BBBC762E4E9106E9CF8184B803322B7
Digest test failed!
Expected: 5F5CA355B90AC622B0AA7E654EF5F27E9E75111415B48B8AFE3ADD1C6B89CBA1
Got:      EAD74CD9DF2DE0250D228F9D9D034B1A8BFCC13CC9032CCD8BC3A0F94F1AD9A9

[ This was done on a Mac Pro, running Mac OS X 10.6.7 ]

Note that when you build this program, one of the cryptoPP files gets
recompiled, too.
Quuxplusone commented 13 years ago

Attached 9524-v.txt (3116 bytes, text/plain): Output from clang++ -v when building 9524-mtc.cpp

Quuxplusone commented 13 years ago

Attached 9524.o (290108 bytes, application/x-object): Single file test case

Quuxplusone commented 13 years ago

This bug still exists with today's TOT.