Code Coverage spews "cannot merge previous GCDA file" into Console and crashes with EXEC_BAD_ACCESS

Originator:moegoestohell
Number:rdar://24613381 Date Originated:11-Feb-2016 12:21 PM
Status:Open Resolved:
Product:Developer Tools Product Version:Xcode 7.2.1 (7C1002)
Classification:Crash/Hang/Data Loss Reproducible:Always
 
Summary:
When turning on code coverage and running unit tests, the following content is logged to the console
profiling: REDACTED/AppKit.gcda: cannot merge previous GCDA file: corrupt arc tag (0x65537463) // or some other memory address at the end.
After that, the test run gets terminated with EXEC_BAD_ACCESS.

Steps to Reproduce:
1. have a mac app with working unit tests (no 3rd party libs)
2. enable code coverage 
3. CMD - U to run the unit tests

Expected Results:
Tests are run and we get code coverage.

Actual Results:
All tests are run as expected, but generating the coverage report spews in log messages in the Console and we receive the 

Regression:
All versions of Xcode 7 including 7.2.1

Notes:
The following workaround solves the problem but breaks code coverage:
In your main target (be it a framework, or an app) set:
     Enable Code Coverage Support to YES
     Generage Legacy Test Coverage Files to YES
     Instrument Program Flow to NO
For my purposes I only did this for Debug builds, but your needs may vary.
 
Then in your Tests target set:
     Enable Code Coverage Support to NO
     Generage Legacy Test Coverage Files to NO
     Instrument Program Flow to NO

Comments


Please note: Reports posted here will not necessarily be seen by Apple. All problems should be submitted at bugreport.apple.com before they are posted here. Please only post information for Radars that you have filed yourself, and please do not include Apple confidential information in your posts. Thank you!