Bug 216614 - editors/emacs-devel: clang 4.0 crashes during build
Summary: editors/emacs-devel: clang 4.0 crashes during build
Status: Closed FIXED
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: --- Affects Only Me
Assignee: Ashish SHUKLA
Keywords: needs-patch
Depends on:
Blocks: 216008
  Show dependency treegraph
Reported: 2017-01-30 21:45 UTC by Jan Beich
Modified: 2017-02-02 23:05 UTC (History)
1 user (show)

See Also:
bugzilla: maintainer-feedback? (ashish)

src/buffer.c (preprocessed, compressed) (375.57 KB, application/x-xz)
2017-01-30 21:47 UTC, Jan Beich
no flags Details
command line args (for clang 4.0) (6.36 KB, text/plain)
2017-01-30 21:47 UTC, Jan Beich
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Jan Beich freebsd_committer 2017-01-30 21:45:12 UTC
Assertion failed: ((KnownZero & KnownOne) == 0 && "Bits known to be one AND zero?"), function computeKnownBits, file /usr/src/contrib/llvm/lib/Analysis/ValueTracking.cpp, line 1594.
cc: error: unable to execute command: Abort trap
cc: error: clang frontend command failed due to signal (use -v to see invocation)
FreeBSD clang version 4.0.0 (branches/release_40 293443) (based on LLVM 4.0.0)
Target: x86_64-unknown-freebsd12.0
Thread model: posix
InstalledDir: /usr/bin

Comment 1 Jan Beich freebsd_committer 2017-01-30 21:47:19 UTC
Created attachment 179444 [details]
src/buffer.c (preprocessed, compressed)
Comment 2 Jan Beich freebsd_committer 2017-01-30 21:47:52 UTC
Created attachment 179445 [details]
command line args (for clang 4.0)
Comment 3 Dimitry Andric freebsd_committer 2017-01-31 07:53:58 UTC
Reproduced, test case submitted in upstream bug:
Comment 4 commit-hook freebsd_committer 2017-02-02 23:02:29 UTC
A commit references this bug:

Author: dim
Date: Thu Feb  2 23:01:30 UTC 2017
New revision: 313110
URL: https://svnweb.freebsd.org/changeset/base/313110

  Pull in r293773 from upstream llvm trunk (by Sanjay Patel):

    [ValueTracking] avoid crashing from bad assumptions (PR31809)

    A program may contain llvm.assume info that disagrees with other
    analysis. This may be caused by UB in the program, so we must not
    crash because of that.

    As noted in the code comments:
    ...we can do better, but this at least avoids the assert/crash in the
    bug report.

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

  This fixes an assertion when building editors/emacs-devel.

  PR:		216614

Comment 5 Dimitry Andric freebsd_committer 2017-02-02 23:05:48 UTC
Should be fixed now.  Note that upstream has indicated that what emacs is doing is most likely some undefined behavior, so please take care.  I have built emacs-devel with this fix, and it seems to work OK, with light testing (both in a terminal, and as an X client).