[cmake-developers] [CMake 0012474]: SWIG module should default to use -fno-strict-aliasing

Mantis Bug Tracker mantis at public.kitware.com
Thu Sep 22 12:41:29 EDT 2011


The following issue has been SUBMITTED. 
====================================================================== 
http://www.cmake.org/Bug/view.php?id=12474 
====================================================================== 
Reported By:                Aaron Simmons
Assigned To:                
====================================================================== 
Project:                    CMake
Issue ID:                   12474
Category:                   CMake
Reproducibility:            always
Severity:                   major
Priority:                   normal
Status:                     new
====================================================================== 
Date Submitted:             2011-09-22 12:41 EDT
Last Modified:              2011-09-22 12:41 EDT
====================================================================== 
Summary:                    SWIG module should default to use
-fno-strict-aliasing
Description: 
SWIG has a pretty big gotcha buried in the docs: you have to know to pass
-fno-strict-aliasing to gcc, otherwise crazy things might happen.  It's
documented here:  http://www.swig.org/Doc2.0/Java.html#Java_compiling_dynamic

I think the SWIG module in CMake should default to using -fno-strict-aliasing.


Steps to Reproduce: 
1. Set up a C/C++ module that passes back a pointer.
2. Use CMake and SWIG to build a JNI library out of (1)
3. Write some Java code that uses the JNI library
4. Build the JNI library in release mode for Android
5. Boom

Part (4) could be for any platform, but it happens most readily for Android.


Additional Information: 
This SWIG gotcha has burned some people already:
http://stackoverflow.com/questions/6753241/passing-pointer-from-c-to-java-becomes-null

While this isn't CMake's issue per se, I think if CMake implemented best
practices for SWIG it would save everyone a lot of headaches.

====================================================================== 

Issue History 
Date Modified    Username       Field                    Change               
====================================================================== 
2011-09-22 12:41 Aaron Simmons  New Issue                                    
======================================================================




More information about the cmake-developers mailing list