Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[SR-1559] Unexpected behavior when running in the interpreter #44168

Open
swift-ci opened this issue May 19, 2016 · 1 comment
Open

[SR-1559] Unexpected behavior when running in the interpreter #44168

swift-ci opened this issue May 19, 2016 · 1 comment
Labels
bug A deviation from expected or documented behavior. Also: expected but undesirable behavior. compiler The Swift compiler in itself

Comments

@swift-ci
Copy link
Collaborator

Previous ID SR-1559
Radar None
Original Reporter babt (JIRA User)
Type Bug
Environment

OS X: 10.11.4
Linux: Ubuntu 15.10
Toolchain: swift-DEVELOPMENT-SNAPSHOT-2016-05-09-a

Additional Detail from JIRA
Votes 0
Component/s Compiler
Labels Bug
Assignee None
Priority Medium

md5: bbb3c300ac906bde504bb6ee80dfffc6

Issue Description:

Consider the following test program:

class Test {
        class func printMemory(ptr: UnsafePointer<Int>) {

                print("At memory:\(ptr)")
        }
}

var arr: [[Int]] = [
                        [0,1,2,3,4],
                        [0,1,2],
                        [0]
]

Test.printMemory(ptr: &arr[0][0])
Test.printMemory(ptr: &arr[0][1])
Test.printMemory(ptr: &arr[0][2])
Test.printMemory(ptr: &arr[1][0])

When run on either OS X or Linux using the REPL, the results are as follows:

babt@Swift-TestVM:~/test/Sources$ swift test.swift
At memory:0x00007ffc55142838
At memory:0x00007ffc55142838
At memory:0x00007ffc55142838
At memory:0x00007ffc55142838

Notice that the printed addresses are all the same.

When running on either OS X or Linux after compiling, the following results are achieved...

babt@Swift-TestVM:~/test/Sources$ swiftc test.swift
babt@Swift-TestVM:~/test/Sources$ ./test
At memory:0x00007ffd8550bb40
At memory:0x00007ffd8550bb30
At memory:0x00007ffd8550bb20
At memory:0x00007ffd8550bb10

This is what I would've expected the results to be.

@Dante-Broggi
Copy link
Contributor

I think this bug is invalid, as it is showing the expected undefined value of a pointer's address for a pointer created from an `inout` value.

@swift-ci swift-ci transferred this issue from apple/swift-issues Apr 25, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug A deviation from expected or documented behavior. Also: expected but undesirable behavior. compiler The Swift compiler in itself
Projects
None yet
Development

No branches or pull requests

2 participants