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-323] Using alloca function in Swift results in linker error #42945

Open
swift-ci opened this issue Dec 20, 2015 · 3 comments
Open

[SR-323] Using alloca function in Swift results in linker error #42945

swift-ci opened this issue Dec 20, 2015 · 3 comments
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-323
Radar rdar://problem/42269493
Original Reporter loic (JIRA User)
Type Bug
Environment

Swift 2.2 (December 18)

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

md5: 6e64deb605de903e90b3c21d02350b0a

Issue Description:

Xcode will autocomplete "all" to "alloca(Int)".
However, trying to compile this program:

import Darwin
let ptr = alloca(10)

will give a linker error:

Undefined symbols for architecture x86_64:
  "_alloca", referenced from:
      _main in main.swift.o
ld: symbol(s) not found for architecture x86_64

I think either "alloca" should be allowed, or Xcode shouldn't suggest it, and it should trigger a less cryptic error message (as it does for "fork").

@belkadan
Copy link
Contributor

Yeah, we should probably blacklist alloca in Swift code. It won't do anything reasonable.

@Dante-Broggi
Copy link
Contributor

`alloca` still fails in linking on Xcode 10 toolchain.

@belkadan
Copy link
Contributor

@swift-ci create

@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

3 participants