Skip to content

CFG builder asserts when goto jumps variable with nontrivial destructor in MS mode #13325

Closed
@zygoloid

Description

@zygoloid
mannequin
Bugzilla Link 12953
Version unspecified
OS Linux
Blocks llvm/llvm-bugzilla-archive#13707
CC @DougGregor,@tritao,@belkadan,@tkremenek,@Weverything

Extended Description

This testcase:

struct X { ~X(); }; void f() { goto end; X x; end:; }

... crashes when built with clang++ -Wuninitialized -fms-compatibility:

<stdin>:1:32: warning: goto into protected scope [-Wmicrosoft]
struct X { ~X(); }; void f() { goto end; X x; end:; }
                               ^
<stdin>:1:44: note: jump bypasses variable with a non-trivial destructor
struct X { ~X(); }; void f() { goto end; X x; end:; }
                                           ^
clang-3.2: lib/Analysis/CFG.cpp:196: int <anonymous namespace>::LocalScope::const_iterator::distance(LocalScope::const_iterator): Assertion `F != const_iterator() && "L iterator is not reachable from F iterator."' failed.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugzillaIssues migrated from bugzillac++clang:frontendLanguage frontend issues, e.g. anything involving "Sema"confirmedVerified by a second party

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions