Bug 257978

Summary: clang-11.0.1 crashes on FreeBSD 14-CURRENT on the multimedia/minitube port
Product: Base System Reporter: Yuri Victorovich <yuri>
Component: binAssignee: Dimitry Andric <dim>
Status: Closed FIXED    
Severity: Affects Only Me CC: dim
Priority: --- Keywords: regression
Version: CURRENT   
Hardware: Any   
OS: Any   
URL: https://reviews.llvm.org/D98068
See Also: https://bugs.llvm.org/show_bug.cgi?id=51572

Description Yuri Victorovich freebsd_committer freebsd_triage 2021-08-21 03:56:37 UTC

    
Comment 1 Yuri Victorovich freebsd_committer freebsd_triage 2021-08-21 03:57:54 UTC
It crashes on 14, but not on 13
Comment 2 Dimitry Andric freebsd_committer freebsd_triage 2021-08-21 15:32:41 UTC
This is fixed by upstream commit https://github.com/llvm/llvm-project/commit/79f9cfbc21e02555258523ea77c3dd389891cfb3, which I will merge into main (which has clang 12.0.1) and MFC back to stable/13 and optionally stable/{11,12}.
Comment 3 commit-hook freebsd_committer freebsd_triage 2021-08-21 21:04:38 UTC
A commit in branch main references this bug:

URL: https://cgit.FreeBSD.org/src/commit/?id=efa485d5c390b745f53761da9159721243c48b7b

commit efa485d5c390b745f53761da9159721243c48b7b
Author:     Dimitry Andric <dim@FreeBSD.org>
AuthorDate: 2021-08-21 21:03:37 +0000
Commit:     Dimitry Andric <dim@FreeBSD.org>
CommitDate: 2021-08-21 21:03:50 +0000

    Apply clang fix for assertion failure compiling multimedia/minitube

    Merge commit 79f9cfbc21e0 from llvm git (by Yaxun (Sam) Liu):

      Do not merge LocalInstantiationScope for template specialization

      A lambda in a function template may be recursively instantiated. The recursive
      lambda will cause a lambda function instantiated multiple times, one inside another.
      The inner LocalInstantiationScope should not be marked as MergeWithParentScope
      since it already has references to locals properly substituted, otherwise it causes
      assertion due to the check for duplicate locals in merged LocalInstantiationScope.

      Reviewed by: Richard Smith

      Differential Revision: https://reviews.llvm.org/D98068

    Reported by:    yuri
    PR:             257978
    MFC after:      3 days

 .../llvm-project/clang/lib/Sema/SemaTemplateInstantiateDecl.cpp    | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)
Comment 4 commit-hook freebsd_committer freebsd_triage 2021-08-26 18:10:13 UTC
A commit in branch stable/13 references this bug:

URL: https://cgit.FreeBSD.org/src/commit/?id=5e9c2a6a902346a6d7d29bc8c81f0b3fcccaa57f

commit 5e9c2a6a902346a6d7d29bc8c81f0b3fcccaa57f
Author:     Dimitry Andric <dim@FreeBSD.org>
AuthorDate: 2021-08-21 21:03:37 +0000
Commit:     Dimitry Andric <dim@FreeBSD.org>
CommitDate: 2021-08-26 18:05:27 +0000

    Apply clang fix for assertion failure compiling multimedia/minitube

    Merge commit 79f9cfbc21e0 from llvm git (by Yaxun (Sam) Liu):

      Do not merge LocalInstantiationScope for template specialization

      A lambda in a function template may be recursively instantiated. The recursive
      lambda will cause a lambda function instantiated multiple times, one inside another.
      The inner LocalInstantiationScope should not be marked as MergeWithParentScope
      since it already has references to locals properly substituted, otherwise it causes
      assertion due to the check for duplicate locals in merged LocalInstantiationScope.

      Reviewed by: Richard Smith

      Differential Revision: https://reviews.llvm.org/D98068

    Reported by:    yuri
    PR:             257978

    (cherry picked from commit efa485d5c390b745f53761da9159721243c48b7b)

 .../llvm-project/clang/lib/Sema/SemaTemplateInstantiateDecl.cpp    | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)
Comment 5 commit-hook freebsd_committer freebsd_triage 2021-08-26 18:10:14 UTC
A commit in branch stable/12 references this bug:

URL: https://cgit.FreeBSD.org/src/commit/?id=d7d2f810f8a9a21282803bf886705656f1af26c3

commit d7d2f810f8a9a21282803bf886705656f1af26c3
Author:     Dimitry Andric <dim@FreeBSD.org>
AuthorDate: 2021-08-21 21:03:37 +0000
Commit:     Dimitry Andric <dim@FreeBSD.org>
CommitDate: 2021-08-26 18:05:13 +0000

    Apply clang fix for assertion failure compiling multimedia/minitube

    Merge commit 79f9cfbc21e0 from llvm git (by Yaxun (Sam) Liu):

      Do not merge LocalInstantiationScope for template specialization

      A lambda in a function template may be recursively instantiated. The recursive
      lambda will cause a lambda function instantiated multiple times, one inside another.
      The inner LocalInstantiationScope should not be marked as MergeWithParentScope
      since it already has references to locals properly substituted, otherwise it causes
      assertion due to the check for duplicate locals in merged LocalInstantiationScope.

      Reviewed by: Richard Smith

      Differential Revision: https://reviews.llvm.org/D98068

    Reported by:    yuri
    PR:             257978

    (cherry picked from commit efa485d5c390b745f53761da9159721243c48b7b)

 .../llvm-project/clang/lib/Sema/SemaTemplateInstantiateDecl.cpp    | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)
Comment 6 commit-hook freebsd_committer freebsd_triage 2021-08-26 18:11:14 UTC
A commit in branch stable/11 references this bug:

URL: https://cgit.FreeBSD.org/src/commit/?id=9e1de6e8250355cda0615332d43bbba61d4d873f

commit 9e1de6e8250355cda0615332d43bbba61d4d873f
Author:     Dimitry Andric <dim@FreeBSD.org>
AuthorDate: 2021-08-21 21:03:37 +0000
Commit:     Dimitry Andric <dim@FreeBSD.org>
CommitDate: 2021-08-26 18:05:01 +0000

    Apply clang fix for assertion failure compiling multimedia/minitube

    Merge commit 79f9cfbc21e0 from llvm git (by Yaxun (Sam) Liu):

      Do not merge LocalInstantiationScope for template specialization

      A lambda in a function template may be recursively instantiated. The recursive
      lambda will cause a lambda function instantiated multiple times, one inside another.
      The inner LocalInstantiationScope should not be marked as MergeWithParentScope
      since it already has references to locals properly substituted, otherwise it causes
      assertion due to the check for duplicate locals in merged LocalInstantiationScope.

      Reviewed by: Richard Smith

      Differential Revision: https://reviews.llvm.org/D98068

    Reported by:    yuri
    PR:             257978

    (cherry picked from commit efa485d5c390b745f53761da9159721243c48b7b)

 .../llvm-project/clang/lib/Sema/SemaTemplateInstantiateDecl.cpp    | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)