r22832 - gnucash/trunk/src/libqof/qof - Compile md5.c with "-fno-strict-aliasing".

Mike Alexander mta at umich.edu
Sun Mar 24 13:58:42 EDT 2013


--On March 24, 2013 2:50:53 PM +0100 Geert Janssens 
<janssens-geert at telenet.be> wrote:

> On Saturday 23 March 2013 20:03:55 Mike Alexander wrote:
>> Author: mta
>> Date: 2013-03-23 20:03:54 -0400 (Sat, 23 Mar 2013)
>> New Revision: 22832
>> Trac: http://svn.gnucash.org/trac/changeset/22832
>>
>> Modified:
>>    gnucash/trunk/src/libqof/qof/Makefile.am
>> Log:
>> Compile md5.c with "-fno-strict-aliasing".
>> The function md5_finish_ctx dereferences type-punned pointers which
>> breaks strict aliasing rules.
>>
> I haven't looked at the code so this may be totally wrong: I wonder
> if it  would be possible to remove the warning by fixing the code
> instead of ignoring  it ?

I'm not ignoring the warning, I'm telling the compiler to turn off the 
optimization that is causing it.  Ignoring the warning is a real bad 
idea since the code generated may not do anything like what you think 
it should do.  There is a discussion of this at 
<http://blog.qt.digia.com/blog/2011/06/10/type-punning-and-strict-aliasing/>. 
Changing the code to avoid the problem (without turning off the 
optimization) is difficult.  You would probably have to change type 
definitions quite a way back up the call chain.

         Mike
 


More information about the gnucash-devel mailing list