Bug 234144 - base clang 6.0.0 Assertion failed: (Result.isUninit() && "temporary created multiple times"), function createTemporary
Summary: base clang 6.0.0 Assertion failed: (Result.isUninit() && "temporary created m...
Status: Closed FIXED
Alias: None
Product: Base System
Classification: Unclassified
Component: bin (show other bugs)
Version: CURRENT
Hardware: Any Any
: --- Affects Only Me
Assignee: Dimitry Andric
URL: https://reviews.llvm.org/D42776
Keywords:
Depends on:
Blocks:
 
Reported: 2018-12-18 19:38 UTC by Val Packett
Modified: 2018-12-31 14:18 UTC (History)
3 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Val Packett 2018-12-18 19:38:23 UTC
When building RawThreapee 5.5:

Assertion failed: (Result.isUninit() && "temporary created multiple times"), function createTemporary, file /usr/src/contrib/llvm/tools/clang/lib/AST/ExprConstant.cpp, line 1174.
c++: error: unable to execute command: Abort trap (core dumped)
c++: error: clang frontend command failed due to signal (use -v to see invocation)
FreeBSD clang version 6.0.1 (tags/RELEASE_601/final 335540) (based on LLVM 6.0.1)
Target: x86_64-unknown-freebsd13.0
Thread model: posix
InstalledDir: /usr/bin


repro file thingy: https://unrelentingtech.s3.dualstack.eu-west-1.amazonaws.com/main-068a89.tar.zst

I haven't updated my -CURRENT to clang7 in base yet, but I guess this clang version is now in 12..

(Are assertions enabled in -STABLE??)
Comment 1 commit-hook freebsd_committer freebsd_triage 2018-12-20 18:29:06 UTC
A commit references this bug:

Author: dim
Date: Thu Dec 20 18:28:55 UTC 2018
New revision: 342281
URL: https://svnweb.freebsd.org/changeset/base/342281

Log:
  Pull in r329671 from upstream clang trunk (by Akira Hatanaka):

    [ExprConstant] Use an AST node and a version number as a key to
    create an APValue and retrieve it from map Temporaries.

    The version number is needed when a single AST node is visited
    multiple times and is used to create APValues that are required to be
    distinct from each other (for example, MaterializeTemporaryExprs in
    default arguments and VarDecls in loops).

    rdar://problem/36505742

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

  This should fix 'Assertion failed: (Result.isUninit() && "temporary
  created multiple times"), function createTemporary' errors (if
  assertions are enabled, otherwise the compiler internal state might go
  bad), when building the graphics/rawtherapee port.

  Direct commit to stable/11 and stable/12, since head already has clang
  7.0.1, which includes this change.

  PR:		234144

Changes:
  stable/11/contrib/llvm/tools/clang/include/clang/AST/APValue.h
  stable/11/contrib/llvm/tools/clang/lib/AST/APValue.cpp
  stable/11/contrib/llvm/tools/clang/lib/AST/ExprConstant.cpp
  stable/12/contrib/llvm/tools/clang/include/clang/AST/APValue.h
  stable/12/contrib/llvm/tools/clang/lib/AST/APValue.cpp
  stable/12/contrib/llvm/tools/clang/lib/AST/ExprConstant.cpp
Comment 2 Dimitry Andric freebsd_committer freebsd_triage 2018-12-20 18:40:45 UTC
Note that assertions aren't enabled in -STABLE branches and releases.  But since this assertion showed that some internal state wasn't consistent, it was better to apply the upstream fix, even though it isn't trivial.
Comment 3 Val Packett 2018-12-20 18:50:57 UTC
(In reply to Dimitry Andric from comment #2)
Thanks!
Comment 4 Dimitry Andric freebsd_committer freebsd_triage 2018-12-31 14:18:08 UTC
Added https://reviews.freebsd.org/D18699 for including the patch in the llvm60 port.