clang SIGSEGV

Originator:mayoff
Number:rdar://37614059 Date Originated:16-Feb-2018 02:14 PM
Status:Open Resolved:
Product:Developer Tools Product Version:Xcode Version 9.2 (9C40b) / macOS 10.12.6 (16G1212)
Classification:Crash/Hang/Data Loss Reproducible:Always
 
Summary:
Dear clangsters,

Would you like to make clang crash? I will tell you how. Compile the following program with ARC enabled.

    static void blockReceiver(void (^block)(id objects[])) {
        return;
    }

    static void blockSender() {
        blockReceiver(^(id objects[]){});
    }

    int main(int argc, const char * argv[]) {
        return 0;
    }

Love,
Rob


Steps to Reproduce:
1. Put the program shown above in a file `t.m`.

2. Compile the program with this command: 

    clang -fobjc-arc -c t.m



Expected Results:
Not crash.

Actual Results:
Crash.

    :; clang -fobjc-arc -c t.m
    t.m:1:44: error: must explicitly describe intended ownership of an object array parameter
    static void blockReceiver(void (^block)(id objects[])) {
                                               ^
    clang: error: unable to execute command: Segmentation fault: 11
    clang: error: clang frontend command failed due to signal (use -v to see invocation)
    Apple LLVM version 9.0.0 (clang-900.0.39.2)
    Target: x86_64-apple-darwin16.7.0
    Thread model: posix
    InstalledDir: /Applications/Xcode-9.2.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin
    clang: note: diagnostic msg: PLEASE submit a bug report to http://developer.apple.com/bugreporter/ and include the crash backtrace, preprocessed source, and associated run script.
    clang: note: diagnostic msg: 
    ********************
    
    PLEASE ATTACH THE FOLLOWING FILES TO THE BUG REPORT:
    Preprocessed source(s) and associated run script(s) are located at:
    clang: note: diagnostic msg: /var/folders/5j/b96_pfw966780pdmgh6fk4dc0000gn/T/t-3114d5.m
    clang: note: diagnostic msg: /var/folders/5j/b96_pfw966780pdmgh6fk4dc0000gn/T/t-3114d5.sh
    clang: note: diagnostic msg: Crash backtrace is located in
    clang: note: diagnostic msg: /Users/mayoff/Library/Logs/DiagnosticReports/clang_<YYYY-MM-DD-HHMMSS>_<hostname>.crash
    clang: note: diagnostic msg: (choose the .crash file that corresponds to your crash)
    clang: note: diagnostic msg: 
    
    ********************


Version:
Xcode Version 9.2 (9C40b) / macOS 10.12.6 (16G1212)

Notes:

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!