Environment
macOS Catalina 10.15.3
\`swift --version\`
``` java
Apple Swift version 5.2 (swiftlang-1103.0.32.1 clang-1103.0.32.29)
Target: x86_64-apple-darwin19.3.0
```
Xcode 11.4 (Not necessary it can be reproduced using the swiftc compiler)
Additional Detail from JIRA
| | |
|------------------|-----------------|
|Votes | 0 |
|Component/s | Compiler |
|Labels | Bug |
|Assignee | None |
|Priority | Medium |
md5: bdc1a101ab95f24062c16848738af624
Issue Description:
The following code crashes with a bad access error when compiled with the -Onone flag. It does work using the REPL or when compiled using -O and -Osize.
struct Transform {
var position: SIMD3<Float>
}
class Node {
private var transform: Transform
var position: SIMD3<Float> {
get { return transform.position }
set { transform.position = newValue}
}
init() {
transform = Transform(position: SIMD3<Float>(0, 0, 0))
}
}
let node = Node()
print(node.position) //SIMD3<Float>(0.0, 0.0, 0.0)
node.position = SIMD3<Float>(1, 1, 1)
print(node.position) //SIMD3<Float>(1.0, 1.0, 1.0)
node.position.x = 3
print(node.position) //SIMD3<Float>(3.0, 1.0, 1.0)
node.position.y = node.position.y + 5
print(node.position) // SIMD3<Float>(3.0, 6.0, 1.0)
node.position.z += 9 // getting a bad access error here
print(node.position)
Environment
macOS Catalina 10.15.3 \`swift --version\` ``` java Apple Swift version 5.2 (swiftlang-1103.0.32.1 clang-1103.0.32.29) Target: x86_64-apple-darwin19.3.0 ``` Xcode 11.4 (Not necessary it can be reproduced using the swiftc compiler)Additional Detail from JIRA
| | | |------------------|-----------------| |Votes | 0 | |Component/s | Compiler | |Labels | Bug | |Assignee | None | |Priority | Medium | md5: bdc1a101ab95f24062c16848738af624Issue Description:
The following code crashes with a bad access error when compiled with the -Onone flag. It does work using the REPL or when compiled using -O and -Osize.
resulting in:
Compared to:
resulting in: