> Or do I need an extra tool to employ -fsanitize=undefined?
No, its built into Clang.

The Undefined Behavior Sanitizer (UBSan) is based on John Reghr's
Integer Overflow Checker (but it has a lot more checks now).
http://embed.cs.utah.edu/ioc/.

> I chose to stay away from Macports clang
I don't know about Macports since I don't really use it.

Attached is my recipe to build Clang from sources. It looks like it
needs to be updated for Clang 3.5.0.

I've never had a problem with it (well, except on OS X).

Jeff

On Mon, Jan 5, 2015 at 8:41 PM, Mobile Mouse <[email protected]> wrote:
> On Jan 5, 2015, at 14:48 , Jeffrey Walton <[email protected]> wrote:
>>>   CXXFLAGS += -fsanitize=undefined
>>>
>>> Hmm… Do we need this?
>>
>> On occasion.
>>
>> When Whirlpool was failing its self tests under Intel's compiler (ICPC
>> and ICC), I used Clang and its undefined behavior sanitizer to locate
>> the offending code.
>
> Well,  even the latest release of Apple clang does not support this flag. And 
> since I’ve had unpleasant experience of having compiled code running 
> correctly when built by Xcode clang, but crashing with SEGV when built by 
> clang installed via Macports - I chose to stay away from Macports clang (and 
> from Macports gcc-4.9, which cannot produce a working CryptoPP).
>
> Or do I need an extra tool to employ -fsanitize=undefined?
>
>> That's where this mess came from (from misc.h):
>>
>>    template <class T> inline T rotrMod(T x, unsigned int y)
>>    {
>>        y %= sizeof(T)*8;
>>        return T((x>>y) | (x<<(sizeof(T)*8-y)));
>>    }
>>
>> The modular reduction side stepped the undefined behavior by keeping
>> the shift amount less than or equal to a register size.
>>
>> I also use -fsanitize=undefined and -fsanitize=address on my patches
>> to ensure they are not introducing undefined behavior or memory
>> errors. (In addition to -Wall -Wextra).
>>
>> Clang's Asan (Address Sanitizer) is a good tool. It performs dynamic
>> analysis, all its positives are real hits, and does not emulate some
>> instructions like Valgrind.

-- 
-- 
You received this message because you are subscribed to the "Crypto++ Users" 
Google Group.
To unsubscribe, send an email to [email protected].
More information about Crypto++ and this group is available at 
http://www.cryptopp.com.
--- 
You received this message because you are subscribed to the Google Groups 
"Crypto++ Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Attachment: Missing-Makefile
Description: Binary data

Attachment: clang-3.4.2-recipe.sh
Description: Bourne shell script

Reply via email to