Adding property of type SCNVector3 yields "Abort trap: 6" error

Originator:bendstahl
Number:rdar://21376523 Date Originated:2015-06-14
Status:Closed (Duplicate of 21294916) Resolved:
Product:Xcode Product Version:7.0
Classification:Serious Bug Reproducible:Yes
 
------------------
Summary:
------------------

When using Swift 2 with Xcode 7 beta-1 (7A120f), with SceneKit for iOS, using SCNVector3 produces "Abort trap: 6" compile error. This happens whether a project is migrated from (Swift 1.2 + Xcode 6.3) to (Swift 2 + Xcode 7.0), or with a fresh Swift 2 + Xcode 7.0 project. Error text is below:

[COMMAND LINE COMPILER OPTIONS OMITTED BECAUSE OF 3,000 WORD BUG REPORT LIMIT]

Assertion failed: ((IGF.IGM.DataLayout.getTypeSizeInBits(coercionTy) == IGF.IGM.DataLayout.getTypeSizeInBits(paramTI.StorageType)) && "Coerced types should not differ in size!"), function emitDirectExternalParameter, file /Library/Caches/com.apple.xbs/Sources/swiftlang/swiftlang-700.0.38.1/src/swift/lib/IRGen/IRGenSIL.cpp, line 908.
0  swift                    0x000000010c9cae0b llvm::sys::PrintStackTrace(__sFILE*) + 43
1  swift                    0x000000010c9cb54b SignalHandler(int) + 379
2  libsystem_platform.dylib 0x00007fff9030cf1a _sigtramp + 26
3  libsystem_platform.dylib 0x0000000000000007 _sigtramp + 1875849479
4  libsystem_c.dylib        0x00007fff900cab53 abort + 129
5  libsystem_c.dylib        0x00007fff90092c39 basename + 0
6  swift                    0x000000010ab1269d (anonymous namespace)::IRGenSILFunction::emitSILFunction() + 13693
7  swift                    0x000000010ab0ed52 swift::irgen::IRGenModule::emitSILFunction(swift::SILFunction*) + 498
8  swift                    0x000000010aa5f46c swift::irgen::IRGenModuleDispatcher::emitGlobalTopLevel() + 412
9  swift                    0x000000010aaf5515 performIRGeneration(swift::IRGenOptions&, swift::ModuleDecl*, swift::SILModule*, llvm::StringRef, llvm::LLVMContext&, swift::SourceFile*, unsigned int) + 821
10 swift                    0x000000010aaf5926 swift::performIRGeneration(swift::IRGenOptions&, swift::SourceFile&, swift::SILModule*, llvm::StringRef, llvm::LLVMContext&, unsigned int) + 70
11 swift                    0x000000010a9e505f performCompile(swift::CompilerInstance&, swift::CompilerInvocation&, llvm::ArrayRef<char const*>, int&) + 11663
12 swift                    0x000000010a9e20b3 frontend_main(llvm::ArrayRef<char const*>, char const*, void*) + 2515
13 swift                    0x000000010a9de28f main + 1983
14 libdyld.dylib            0x00007fff92d4d5c9 start + 1
Stack dump:

[0. PROGRAM ARGUMENTS OMITTED BECAUSE OF 3,000 WORD BUG REPORT LIMIT]

1.	While emitting IR SIL function @_TToFC18AbortTrapTestSwift18GameViewControllers1pVSC10SCNVector3 for 'p' at /Users/bstahl/Library/Mobile Documents/com~apple~CloudDocs/Developer/Code/AbortTrapTestSwift/AbortTrapTestSwift/GameViewController.swift:14:6

------------------
Steps to Reproduce:
------------------

Setup: Install Xcode 7.0 (7A120f). Check for current SDKs and documentation in Preferences and install.

1. Create a brand-new project in Xcode 7 beta-1. Type is "iOS>Application>Game", Language is "Swift", Game Technology is "SceneKit".
 
2. Build and run with default settings. Project builds and runs fine in simulator (you will see the default rotating 3D spaceship model).
 
3. Add a single SCNVector3 property to the gamecontroller in GameViewController.swift, like this:
 
class GameViewController: UIViewController {  
  var p = SCNVector3Zero  
 
--> Produces "Abort trap: 6". Project will no longer compile.
 
4. Change the constant to an empty initializer.
 
class GameViewController: UIViewController {  
  var p = SCNVector3()  
 
--> Same problem, "Abort trap: 6"
 
5. Remove property, restoring to the clean project state.

--> "Abort trap: 6" is gone, project again compiles and runs.
 
6. Change "var" to "let".
 
class GameViewController: UIViewController {  
  let p = SCNVector4Zero
  
-- > Compiles and runs.

7. Change property type to SCNVector4 instead of SCNVector3.
 
class GameViewController: UIViewController {  
  var p = SCNVector4Zero
  
-- > Compiles and runs.

------------------
Expected Results:
------------------

Project should compile and run. Before adding SCNVector3 property, project already runs, therefore it should already be using SceneKit and its associated type.

------------------
Actual Results:
------------------

Project will not compile and exits with "Abort trap: 6" error. There are no suggestions for fixing the problem.

------------------
Version:
------------------

Xcode: 7.0 beta (7A120f)
OS X: 10.10.3 (14D136)

------------------
Notes:
------------------

Bug DOES NOT occur if:
- property "var" is changed to "let".
- property type is changed from SCNVector3 type to SCNVector4 type ("var" or "let").
- property declaration is removed from project.
- project is created and compiled under Swift 1.2 in Xcode 6.3.X

Bug STILL occurs if:
- property uses an initializer instead of SCNVector3Zero ("var p = SCNVector3()").

------------------
Configuration:
------------------

Mid-2011 13" MacBook Air, 1.8 GHz Intel Core i7, 4 GB RAM, 256 GB SSD
Model Identifier: MacBookAir4,2
SMC Version (system): 1.73f66
Boot ROM Version: MBA41.0077.B11

OS X Yosemite 10.10.3 (14D136)

------------------
Attachments:
------------------

'AbortTrapTestSwift.zip' was successfully uploaded.

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!