Clang randomly crashes because of the [-Wunused-parameter]

Originator:macmade
Number:rdar://30943715 Date Originated:09-Mar-2017 11:01 AM
Status:Duplicate (Closed) Resolved:
Product:Developer Tools Product Version:
Classification: Reproducible:Sometimes
 
I've not been able to determine under which circumstances this happens, or to reproduce it in a test project, unfortunately.

Full invocation follows, crash report is attached:
Note that additional warning flags are enabled with pragmas.
Those flags can be found here: https://github.com/macmade/SeriousCode/blob/master/clang-warnings.h

CompileC <redacted>.o <redacted>.cpp normal x86_64 c++ com.apple.compilers.llvm.clang.1_0.compiler
    cd <redacted>
    export LANG=en_US.US-ASCII
    /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang
            -x
            c++
            -arch
            x86_64
            -fmessage-length=0
            -fdiagnostics-show-note-include-stack
            -fmacro-backtrace-limit=0
            -std=c++11
            -stdlib=libc++
            -gmodules
            -Wno-trigraphs
            -fpascal-strings
            -O0
            -fno-common
            -Werror
            -Werror=incompatible-pointer-types
            -Wmissing-field-initializers
            -Wmissing-prototypes
            -Werror=return-type
            -Wdocumentation
            -Wunreachable-code
            -Wnullable-to-nonnull-conversion
            -Werror=deprecated-objc-isa-usage
            -Werror=objc-root-class
            -Wnon-virtual-dtor
            -Woverloaded-virtual
            -Wexit-time-destructors
            -Wmissing-braces
            -Wparentheses
            -Wswitch
            -Wunused-function
            -Wunused-label
            -Wunused-parameter
            -Wunused-variable
            -Wunused-value
            -Wempty-body
            -Wconditional-uninitialized
            -Wunknown-pragmas
            -pedantic
            -Wshadow
            -Wfour-char-constants
            -Wconversion
            -Wconstant-conversion
            -Wint-conversion
            -Wbool-conversion
            -Wenum-conversion
            -Wsign-compare
            -Wshorten-64-to-32
            -Wnewline-eof
            -Wc++11-extensions
            -DDEBUG=1
            -DHAVE_CONFIG_H
            -isysroot
            /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.12.sdk
            -fasm-blocks
            -fstrict-aliasing
            -Wdeprecated-declarations
            -Winvalid-offsetof
            -mmacosx-version-min=10.7
            -g
            -fvisibility-inlines-hidden
            -Wsign-conversion
            -Winfinite-recursion
            -Wmove
            -fsanitize=address
            -D_LIBCPP_HAS_NO_ASAN
            -iquote
            <redacted>-generated-files.hmap
            -I<redacted>-own-target-headers.hmap
            -I<redacted>-all-target-headers.hmap
            -iquote
            <redacted>-project-headers.hmap
            -iquote<redacted>
            -I<redacted>
            -F<redacted>
            -F/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.12.sdk/System/Library/PrivateFrameworks
            -F/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.12.sdk/../../../../../../../../../System/Library/PrivateFrameworks
            -F/Library/Frameworks
            -fstack-protector-all
            -include
            <redacted>-Prefix.pch
            -MMD
            -MT
            dependencies
            -MF
            <redacted>.d
            --serialize-diagnostics
            <redacted>.dia
            -c
            <redacted>.cpp
            -o
            <redacted>.o

<redacted>.cpp:3305:70: fatal error: unused parameter '<redacted>' [-Wunused-parameter]
    bool <redacted>::<redacted>( bool <redacted>, volatile bool & <redacted>, std::function< void( void ) > <redacted> )
                                       ^
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 8.0.0 (clang-800.0.42.1)
Target: x86_64-apple-darwin16.5.0
Thread model: posix
InstalledDir: /Applications/Xcode.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:

--------------------------------------------------------------------------------

Version:

Mac OS X 10.12.4 (16E163f) / Xcode Version 8.2.1 (8C1002)

--------------------------------------------------------------------------------

Configuration:

Happens randomly - Concerned project is quite big, mixing C, C++ and Objective-C (with and without ARC).
Problem mainly happens on C++ files.

--------------------------------------------------------------------------------

Attachments:

Process:               clang [64229]
Path:                  /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang
Identifier:            clang
Version:               8.0.0 (.)
Code Type:             X86-64 (Native)
Parent Process:        clang [64216]
Responsible:           clang [64229]
User ID:               501

Date/Time:             2017-03-08 18:08:41.993 +0100
OS Version:            Mac OS X 10.12.4 (16E163f)
Report Version:        12
Anonymous UUID:        0BC982FE-7BE3-3EC9-0866-0E2E9BC3B689

Sleep/Wake UUID:       C3C9F392-40BD-41F8-8821-3BBAE5534B62

Time Awake Since Boot: 190000 seconds
Time Since Wake:       12000 seconds

System Integrity Protection: enabled

Crashed Thread:        0  Dispatch queue: com.apple.main-thread

Exception Type:        EXC_BAD_ACCESS (SIGSEGV)
Exception Codes:       KERN_INVALID_ADDRESS at 0x0000000000000004
Exception Note:        EXC_CORPSE_NOTIFY

Termination Signal:    Segmentation fault: 11
Termination Reason:    Namespace SIGNAL, Code 0xb
Terminating Process:   exc handler [0]

VM Regions Near 0x4:
--> 
    __TEXT                 000000010ecdf000-000000011192e000 [ 44.3M] r-x/rwx SM=COW  /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang

Thread 0 Crashed:: Dispatch queue: com.apple.main-thread
0   clang                         	0x000000010ef8fbba (anonymous namespace)::CFGBuilder::addLocalScopeForVarDecl(clang::VarDecl*, (anonymous namespace)::LocalScope*) + 426
1   clang                         	0x000000010ef8f8b9 (anonymous namespace)::CFGBuilder::addLocalScopeForStmt(clang::Stmt*) + 265
2   clang                         	0x000000010ef8f714 (anonymous namespace)::CFGBuilder::VisitCompoundStmt(clang::CompoundStmt*) + 52
3   clang                         	0x000000010ef80559 clang::CFG::buildCFG(clang::Decl const*, clang::Stmt*, clang::ASTContext*, clang::CFG::BuildOptions const&) + 3913
4   clang                         	0x000000010ef7e5b1 clang::AnalysisDeclContext::getCFG() + 289
5   clang                         	0x000000010ef1ef57 clang::sema::AnalysisBasedWarnings::IssueWarnings(clang::sema::AnalysisBasedWarnings::Policy, clang::sema::FunctionScopeInfo*, clang::Decl const*, clang::BlockExpr const*) + 4103
6   clang                         	0x000000010ef1ddde clang::Sema::PopFunctionScopeInfo(clang::sema::AnalysisBasedWarnings::Policy const*, clang::Decl const*, clang::BlockExpr const*) + 78
7   clang                         	0x000000010ef18868 clang::Sema::ActOnFinishFunctionBody(clang::Decl*, clang::Stmt*, bool) + 8008
8   clang                         	0x000000010eea1936 clang::Parser::ParseFunctionStatementBody(clang::Decl*, clang::Parser::ParseScope&) + 198
9   clang                         	0x000000010ee9ce90 clang::Parser::ParseFunctionDefinition(clang::ParsingDeclarator&, clang::Parser::ParsedTemplateInfo const&, clang::Parser::LateParsedAttrList*) + 544
10  clang                         	0x000000010edb7313 clang::Parser::ParseDeclGroup(clang::ParsingDeclSpec&, unsigned int, clang::SourceLocation*, clang::Parser::ForRangeInit*) + 2467
11  clang                         	0x000000010ed891c3 clang::Parser::ParseDeclOrFunctionDefInternal(clang::Parser::ParsedAttributesWithRange&, clang::ParsingDeclSpec&, clang::AccessSpecifier) + 227
12  clang                         	0x000000010ed88a34 clang::Parser::ParseDeclarationOrFunctionDefinition(clang::Parser::ParsedAttributesWithRange&, clang::ParsingDeclSpec*, clang::AccessSpecifier) + 260
13  clang                         	0x000000010ed870cd clang::Parser::ParseExternalDeclaration(clang::Parser::ParsedAttributesWithRange&, clang::ParsingDeclSpec*) + 141
14  clang                         	0x000000010fafc8a6 clang::Parser::ParseInnerNamespace(std::__1::vector<clang::SourceLocation, std::__1::allocator<clang::SourceLocation> >&, std::__1::vector<clang::IdentifierInfo*, std::__1::allocator<clang::IdentifierInfo*> >&, std::__1::vector<clang::SourceLocation, std::__1::allocator<clang::SourceLocation> >&, unsigned int, clang::SourceLocation&, clang::ParsedAttributes&, clang::BalancedDelimiterTracker&) + 214
15  clang                         	0x000000010faf93e3 clang::Parser::ParseNamespace(unsigned int, clang::SourceLocation&, clang::SourceLocation) + 1059
16  clang                         	0x000000010edb3586 clang::Parser::ParseDeclaration(unsigned int, clang::SourceLocation&, clang::Parser::ParsedAttributesWithRange&) + 470
17  clang                         	0x000000010ed87529 clang::Parser::ParseExternalDeclaration(clang::Parser::ParsedAttributesWithRange&, clang::ParsingDeclSpec*) + 1257
18  clang                         	0x000000010ed86de0 clang::Parser::ParseTopLevelDecl(clang::OpaquePtr<clang::DeclGroupRef>&) + 176
19  clang                         	0x000000010ed62c22 clang::ParseAST(clang::Sema&, bool, bool) + 194
20  clang                         	0x000000010ed5f68c clang::FrontendAction::Execute() + 44
21  clang                         	0x000000010ed1f351 clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) + 2161
22  clang                         	0x000000010ed1cd99 clang::ExecuteCompilerInvocation(clang::CompilerInstance*) + 6185
23  clang                         	0x000000010ece5059 main + 8889
24  libdyld.dylib                 	0x00007fff977f6235 start + 1

Thread 0 crashed with X86 Thread State (64-bit):
  rax: 0x00007fc8f11cae8c  rbx: 0x000000011ac3ea10  rcx: 0x00007fc8f11cae88  rdx: 0x0000000000000004
  rdi: 0x00007fc8ef828c18  rsi: 0x000000010ee23c5b  rbp: 0x00007fff50f17e20  rsp: 0x00007fff50f17dc0
   r8: 0x00007fc8f025c000   r9: 0x00007fc8f025c000  r10: 0x0000000000000000  r11: 0x00000000000012e8
  r12: 0x000000011ac3ef58  r13: 0x00007fff50f17f30  r14: 0x0000000000000000  r15: 0x000000011ac3eac8
  rip: 0x000000010ef8fbba  rfl: 0x0000000000010202  cr2: 0x0000000000000004
  
Logical CPU:     5
Error Code:      0x00000004
Trap Number:     14


Binary Images:
       0x10ecdf000 -        0x11192dffb +clang (8.0.0 - .) <78241A34-6658-384A-A9FF-768F2F4CC4F7> /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang
       0x1140e8000 -        0x114125dc7  dyld (433.5) <2A486B8A-0CCE-3025-AF71-5003A95AB235> /usr/lib/dyld
    0x7fff9624f000 -     0x7fff96250ffb  libSystem.B.dylib (1238.50.2) <18A00F35-4604-3783-8BA4-49D44ECFB370> /usr/lib/libSystem.B.dylib
    0x7fff9637a000 -     0x7fff96388ff7  libbz2.1.0.dylib (38) <25D9FACF-5583-348A-80A0-2B51DCE37680> /usr/lib/libbz2.1.0.dylib
    0x7fff96389000 -     0x7fff963dfff7  libc++.1.dylib (307.5) <0B43BB5D-E6EB-3464-8DE9-B41AC8ED9D1C> /usr/lib/libc++.1.dylib
    0x7fff963e0000 -     0x7fff9640afff  libc++abi.dylib (307.3) <009CDFBC-F7BB-3907-B657-D0589F989341> /usr/lib/libc++abi.dylib
    0x7fff96949000 -     0x7fff96b6effb  libicucore.A.dylib (57163.0.1) <18D74D6C-1960-389A-9524-5AA9102916E1> /usr/lib/libicucore.A.dylib
    0x7fff96b76000 -     0x7fff96b8fffb  liblzma.5.dylib (10) <44BD0279-99DD-36B5-8A6E-C11432E2098D> /usr/lib/liblzma.5.dylib
    0x7fff96e50000 -     0x7fff96e81ffb  libncurses.5.4.dylib (51.30.1) <B03B1BD2-7080-3856-BB02-7E8238320C3B> /usr/lib/libncurses.5.4.dylib
    0x7fff96efd000 -     0x7fff972cf047  libobjc.A.dylib (709) <87C968C7-CC85-3F91-AF07-787AFBC20A33> /usr/lib/libobjc.A.dylib
    0x7fff975d2000 -     0x7fff975dffff  libxar.1.dylib (357) <69547C64-E811-326F-BBED-490C6361BDCB> /usr/lib/libxar.1.dylib
    0x7fff975e0000 -     0x7fff976cfffb  libxml2.2.dylib (30.15) <2DC5819E-5571-3CB3-B357-6FF3BBB39E6F> /usr/lib/libxml2.2.dylib
    0x7fff976fa000 -     0x7fff9770bff3  libz.1.dylib (67) <46E3FFA2-4328-327A-8D34-A03E20BFFB8E> /usr/lib/libz.1.dylib
    0x7fff9771a000 -     0x7fff9771eff7  libcache.dylib (79) <093A4DAB-8385-3D47-A350-E20CB7CCF7BF> /usr/lib/system/libcache.dylib
    0x7fff9771f000 -     0x7fff97729fff  libcommonCrypto.dylib (60092.50.5) <7C2AB4ED-FE74-3047-9FDC-7CCD4420F654> /usr/lib/system/libcommonCrypto.dylib
    0x7fff9772a000 -     0x7fff97731fff  libcompiler_rt.dylib (62) <55D47421-772A-32AB-B529-1A46C2F43B4D> /usr/lib/system/libcompiler_rt.dylib
    0x7fff97732000 -     0x7fff9773afff  libcopyfile.dylib (138) <819BEA3C-DF11-3E3D-A1A1-5A51C5BF1961> /usr/lib/system/libcopyfile.dylib
    0x7fff9773b000 -     0x7fff977befdf  libcorecrypto.dylib (442.50.19) <3BFDD631-AE19-3DF9-96F2-785A2EA9687E> /usr/lib/system/libcorecrypto.dylib
    0x7fff977bf000 -     0x7fff977f0fff  libdispatch.dylib (703.50.35) <60183DB2-D279-3CD6-A69B-C2770F6D8E53> /usr/lib/system/libdispatch.dylib
    0x7fff977f1000 -     0x7fff977f6ffb  libdyld.dylib (433.5) <2B943EC6-C37F-37CC-95EC-27C30F3DE5A5> /usr/lib/system/libdyld.dylib
    0x7fff977f7000 -     0x7fff977f7ffb  libkeymgr.dylib (28) <7AA011A9-DC21-3488-BF73-3B5B14D1FDD6> /usr/lib/system/libkeymgr.dylib
    0x7fff97805000 -     0x7fff97805fff  liblaunch.dylib (972.50.27) <037D198D-9B02-3EF9-A8E9-6F43EA555A9E> /usr/lib/system/liblaunch.dylib
    0x7fff97806000 -     0x7fff9780bff3  libmacho.dylib (898) <5C0ED62A-BD50-31A7-A797-AA713DD613A6> /usr/lib/system/libmacho.dylib
    0x7fff9780c000 -     0x7fff9780eff3  libquarantine.dylib (85.50.1) <AE73E368-0017-3F6E-BAA7-7E7B0E02A90C> /usr/lib/system/libquarantine.dylib
    0x7fff9780f000 -     0x7fff97810ffb  libremovefile.dylib (45) <38D4CB9C-10CD-30D3-8B7B-A515EC75FE85> /usr/lib/system/libremovefile.dylib
    0x7fff97811000 -     0x7fff97829ff7  libsystem_asl.dylib (349.50.5) <096E4228-3B7C-30A6-8B13-EC909A64499A> /usr/lib/system/libsystem_asl.dylib
    0x7fff9782a000 -     0x7fff9782aff7  libsystem_blocks.dylib (67) <10DC5404-73AB-35B3-A277-A8AFECB476EB> /usr/lib/system/libsystem_blocks.dylib
    0x7fff9782b000 -     0x7fff978b8fef  libsystem_c.dylib (1158.50.2) <82551B8A-A230-3EB1-BEB5-A1CD676EDA76> /usr/lib/system/libsystem_c.dylib
    0x7fff978b9000 -     0x7fff978bcffb  libsystem_configuration.dylib (888.50.20) <C2085272-9076-3EAE-9F55-410B9DAAC31C> /usr/lib/system/libsystem_configuration.dylib
    0x7fff978bd000 -     0x7fff978c0fff  libsystem_coreservices.dylib (41.4) <E0415D95-CC57-3DCC-8015-BCA9873D1F3E> /usr/lib/system/libsystem_coreservices.dylib
    0x7fff978c1000 -     0x7fff978d9fff  libsystem_coretls.dylib (121.50.4) <EC6FCF07-DCFB-3A03-9CC9-6DD3709974C6> /usr/lib/system/libsystem_coretls.dylib
    0x7fff978da000 -     0x7fff978e0fff  libsystem_dnssd.dylib (765.50.9) <CE144856-6B6F-3936-98F1-3D6231E40280> /usr/lib/system/libsystem_dnssd.dylib
    0x7fff978e1000 -     0x7fff9790aff7  libsystem_info.dylib (503.50.4) <B891E533-1AE8-3DFC-BED9-B59E94A79E3A> /usr/lib/system/libsystem_info.dylib
    0x7fff9790b000 -     0x7fff9792dff7  libsystem_kernel.dylib (3789.50.208) <65A57D72-DA7C-3EC9-9978-678E0D6E24B4> /usr/lib/system/libsystem_kernel.dylib
    0x7fff9792e000 -     0x7fff97975fe7  libsystem_m.dylib (3121.6) <995883BC-9227-3853-B1BD-6A7DDD768152> /usr/lib/system/libsystem_m.dylib
    0x7fff97976000 -     0x7fff97994ff7  libsystem_malloc.dylib (116.50.8) <DECA6F11-6E4C-328A-9866-5145DD9E5950> /usr/lib/system/libsystem_malloc.dylib
    0x7fff97995000 -     0x7fff979eeffb  libsystem_network.dylib (856.50.55) <3DB6A668-63E4-3602-BF4D-634D2558E6B4> /usr/lib/system/libsystem_network.dylib
    0x7fff979ef000 -     0x7fff979f8ff3  libsystem_networkextension.dylib (563.50.32) <ACA7F380-A5B4-371B-9A4E-BE1262FDAC9F> /usr/lib/system/libsystem_networkextension.dylib
    0x7fff979f9000 -     0x7fff97a02ff3  libsystem_notify.dylib (165.20.1) <B8160190-A069-3B3A-BDF6-2AA408221FAE> /usr/lib/system/libsystem_notify.dylib
    0x7fff97a03000 -     0x7fff97a0bfe7  libsystem_platform.dylib (126.50.8) <C69238B8-1CDE-3606-BA3D-D05327247AA4> /usr/lib/system/libsystem_platform.dylib
    0x7fff97a0c000 -     0x7fff97a16ff7  libsystem_pthread.dylib (218.50.4) <1095CDE2-7392-31E6-B845-E5B857BC7D06> /usr/lib/system/libsystem_pthread.dylib
    0x7fff97a17000 -     0x7fff97a1aff7  libsystem_sandbox.dylib (592.50.47) <16271ECF-7E68-328E-89B6-DBA39585D897> /usr/lib/system/libsystem_sandbox.dylib
    0x7fff97a1b000 -     0x7fff97a1cff3  libsystem_secinit.dylib (24.50.4) <F78B847B-3565-3E4B-98A6-F7AD40392E2D> /usr/lib/system/libsystem_secinit.dylib
    0x7fff97a1d000 -     0x7fff97a24ffb  libsystem_symptoms.dylib (532.50.47) <88B823B7-AD88-31CE-830B-B9D3D7352F8D> /usr/lib/system/libsystem_symptoms.dylib
    0x7fff97a25000 -     0x7fff97a38ff7  libsystem_trace.dylib (518.50.138) <5633A41B-AA4A-382B-A4F7-724F5C2A0F6C> /usr/lib/system/libsystem_trace.dylib
    0x7fff97a39000 -     0x7fff97a3effb  libunwind.dylib (35.3) <3D50D8A8-C460-334D-A519-2DA841102C6B> /usr/lib/system/libunwind.dylib
    0x7fff97a3f000 -     0x7fff97a68ff7  libxpc.dylib (972.50.27) <CAA2582E-C173-3DDF-A033-B8410F2A67C9> /usr/lib/system/libxpc.dylib

External Modification Summary:
  Calls made by other processes targeting this process:
    task_for_pid: 0
    thread_create: 0
    thread_set_state: 0
  Calls made by this process:
    task_for_pid: 0
    thread_create: 0
    thread_set_state: 0
  Calls made by all processes on this machine:
    task_for_pid: 15146815
    thread_create: 0
    thread_set_state: 6823

VM Region Summary:
ReadOnly portion of Libraries: Total=173.8M resident=0K(0%) swapped_out_or_unallocated=173.8M(100%)
Writable regions: Total=158.3M written=0K(0%) resident=0K(0%) swapped_out=0K(0%) unallocated=158.3M(100%)
 
                                VIRTUAL   REGION 
REGION TYPE                        SIZE    COUNT (non-coalesced) 
===========                     =======  ======= 
Kernel Alloc Once                    8K        2 
MALLOC                           150.0M       25 
MALLOC guard page                   16K        4 
STACK GUARD                       56.0M        2 
Stack                             8192K        2 
__DATA                            3968K       50 
__LINKEDIT                       118.1M        4 
__TEXT                            55.7M       48 
mapped file                       70.1M        6 
shared memory                       16K        4 
===========                     =======  ======= 
TOTAL                            461.8M      137

Comments

Duplicate of 29217539 (Closed)

Apple Developer Relations14-Mar-2017 06:07 AM

Engineering has determined that your bug report is a duplicate of another issue and will be closed.

The open or closed status of the original bug report your issue was duplicated to appears in the yellow "Duplicate of XXXXXXXX" section of the bug reporter user interface. This section appears near the top of the right column's bug detail view just under the bug number, title, state, product and rank.

If you have any questions or concerns, please update your report directly here: http://bugreport.apple.com/.


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!