Bug 265755 - clang crashes on math/octave-forge-interval on amd64 on 14
Summary: clang crashes on math/octave-forge-interval on amd64 on 14
Status: Closed FIXED
Alias: None
Product: Base System
Classification: Unclassified
Component: misc (show other bugs)
Version: CURRENT
Hardware: Any Any
: --- Affects Only Me
Assignee: freebsd-toolchain (Nobody)
URL: http://beefy18.nyi.freebsd.org/data/m...
Keywords:
Depends on:
Blocks: 265723
  Show dependency treegraph
 
Reported: 2022-08-10 15:52 UTC by Yuri Victorovich
Modified: 2023-07-23 18:31 UTC (History)
5 users (show)

See Also:
bugzilla: maintainer-feedback?


Attachments
Test case generated by LLVM (819.11 KB, application/x-gzip)
2022-08-16 18:35 UTC, John F. Carr
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Yuri Victorovich freebsd_committer freebsd_triage 2022-08-10 15:52:48 UTC

    
Comment 1 Stephen Montgomery-Smith freebsd_committer freebsd_triage 2022-08-10 20:51:27 UTC
According to the logs I receive from pkg-fallout, the build ends with

===> Compilation failed unexpectedly.

That makes me think it is an issue with the compiler, not the code.
Comment 2 Yuri Victorovich freebsd_committer freebsd_triage 2022-08-10 22:03:53 UTC
(In reply to Stephen Montgomery-Smith from comment #1)

Hi Stephen,

Yes, this is a compiler crash.
I first accidentally created this issue as a port issue and this pinged you.
Sorry about this.

Yuri
Comment 3 John F. Carr 2022-08-16 18:35:07 UTC
Created attachment 235945 [details]
Test case generated by LLVM
Comment 4 Mark Millard 2023-06-28 00:48:54 UTC
Seems like one of buzilla 265755 vs. buzilla 265758 should be classified as
a duplicate of the other, given the same assertion failure.
Comment 5 John F. Carr 2023-07-13 11:57:08 UTC
Is this still a problem?

I have default llvm set to 16 for my ports build and this port compiles.  See also LLVM commit fde5924dcc69fe814085482df259b8cfee236f2c in trunk (17).
Comment 6 commit-hook freebsd_committer freebsd_triage 2023-07-13 18:59:37 UTC
A commit in branch main references this bug:

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

commit 1cd9788408aa9ea4fd0fbc3e06bd9a4eaf8d8d22
Author:     Dimitry Andric <dim@FreeBSD.org>
AuthorDate: 2023-07-13 18:57:22 +0000
Commit:     Dimitry Andric <dim@FreeBSD.org>
CommitDate: 2023-07-13 18:57:22 +0000

    Merge commit fde5924dcc69 from llvm-project (by Serge Pavlov):

      [clang] Reset FP options before template instantiation

      AST nodes that may depend on FP options keep them as a difference
      relative to the options outside the AST node. At the moment of
      instantiation the FP options may be different from the default values,
      defined by command-line option. In such case FP attributes would have
      unexpected values. For example, the code:

          template <class C> void func_01(int last, C) {
            func_01(last, int());
          }
          void func_02() { func_01(0, 1); }
          #pragma STDC FENV_ACCESS ON

      caused compiler crash, because template instantiation takes place at the
      end of translation unit, where pragma STDC FENV_ACCESS is in effect. As
      a result, code in the template instantiation would use constrained
      intrinsics while the function does not have StrictFP attribute.

      To solve this problem, FP attributes in Sema must be set to default
      values, defined by command line options.

      This change resolves https://github.com/llvm/llvm-project/issues/63542.

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

    Requested by:   pkubaj
    PR:             265755, 265758
    MFC after:      1 month

 contrib/llvm-project/clang/lib/Sema/SemaTemplateInstantiateDecl.cpp | 4 ++++
 1 file changed, 4 insertions(+)
Comment 7 commit-hook freebsd_committer freebsd_triage 2023-07-23 18:28:07 UTC
A commit in branch stable/13 references this bug:

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

commit 95955fb872c6a51ff18804b93a2065185955c2a0
Author:     Dimitry Andric <dim@FreeBSD.org>
AuthorDate: 2023-07-13 18:57:22 +0000
Commit:     Dimitry Andric <dim@FreeBSD.org>
CommitDate: 2023-07-23 17:38:12 +0000

    Merge commit fde5924dcc69 from llvm-project (by Serge Pavlov):

      [clang] Reset FP options before template instantiation

      AST nodes that may depend on FP options keep them as a difference
      relative to the options outside the AST node. At the moment of
      instantiation the FP options may be different from the default values,
      defined by command-line option. In such case FP attributes would have
      unexpected values. For example, the code:

          template <class C> void func_01(int last, C) {
            func_01(last, int());
          }
          void func_02() { func_01(0, 1); }
          #pragma STDC FENV_ACCESS ON

      caused compiler crash, because template instantiation takes place at the
      end of translation unit, where pragma STDC FENV_ACCESS is in effect. As
      a result, code in the template instantiation would use constrained
      intrinsics while the function does not have StrictFP attribute.

      To solve this problem, FP attributes in Sema must be set to default
      values, defined by command line options.

      This change resolves https://github.com/llvm/llvm-project/issues/63542.

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

    Requested by:   pkubaj
    PR:             265755, 265758
    MFC after:      1 month

    (cherry picked from commit 1cd9788408aa9ea4fd0fbc3e06bd9a4eaf8d8d22)

 contrib/llvm-project/clang/lib/Sema/SemaTemplateInstantiateDecl.cpp | 4 ++++
 1 file changed, 4 insertions(+)