Uploaded image for project: 'Swift'
  1. Swift
  2. SR-323

Using alloca function in Swift results in linker error

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Open
    • Priority: Medium
    • Resolution: Unresolved
    • Component/s: Compiler
    • Labels:
      None
    • Environment:

      Swift 2.2 (December 18)

      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").

        Attachments

          Activity

            People

            Assignee:
            Unassigned Unassigned
            Reporter:
            loic Loïc Lecrenier
            Votes:
            1 Vote for this issue
            Watchers:
            3 Start watching this issue

              Dates

              Created:
              Updated: