The following issue has been SUBMITTED. 
====================================================================== 
http://www.cmake.org/Bug/view.php?id=14314 
====================================================================== 
Reported By:                Petr Machata
Assigned To:                
====================================================================== 
Project:                    CMake
Issue ID:                   14314
Category:                   CMake
Reproducibility:            always
Severity:                   minor
Priority:                   normal
Status:                     new
====================================================================== 
Date Submitted:             2013-07-25 12:17 EDT
Last Modified:              2013-07-25 12:17 EDT
====================================================================== 
Summary:                    GCC warns about strict aliasing in cm_sha2.c
Description: 
When compiling cm_sha2.c, GCC gives the following warning:

/builddir/build/BUILD/cmake-2.8.11.2/Source/cm_sha2.c: In function
'cmSHA1_Final':
/builddir/build/BUILD/cmake-2.8.11.2/Source/cm_sha2.c:743:2: warning:
dereferencing type-punned pointer will break strict-aliasing rules
[-Wstrict-aliasing]
  *(sha_word64*)&context->s1.buffer[56] = context->s1.bitcount;
  ^

There are four cases total.

Steps to Reproduce: 
1) Compile with recent GCC (4.8?)
2) Inspect compile log

Additional Information: 
I propose fixing this by copying the necessary bytes through union.  This should
lead to the same binary, but will make it clear to GCC that we are only using
the buffer as a bunch of characters.  The test suite passes after applying the
patch, that I attach.
====================================================================== 

Issue History 
Date Modified    Username       Field                    Change               
====================================================================== 
2013-07-25 12:17 Petr Machata   New Issue                                    
2013-07-25 12:17 Petr Machata   File Added: cmake-2.8.11-strict_aliasing.patch  
                 
======================================================================

--

Powered by www.kitware.com

Visit other Kitware open-source projects at 
http://www.kitware.com/opensource/opensource.html

Please keep messages on-topic and check the CMake FAQ at: 
http://www.cmake.org/Wiki/CMake_FAQ

Follow this link to subscribe/unsubscribe:
http://public.kitware.com/cgi-bin/mailman/listinfo/cmake-developers

Reply via email to