Bug 229754 - devel/libslang2 crash during build
Summary: devel/libslang2 crash during build
Status: Closed Unable to Reproduce
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: i386 Any
: --- Affects Only Me
Assignee: Renato Botelho
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2018-07-13 13:30 UTC by Mikhail Teterin
Modified: 2018-09-28 11:32 UTC (History)
2 users (show)

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


Attachments
The C file after preprocessing (236.82 KB, text/plain)
2018-07-13 13:30 UTC, Mikhail Teterin
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Mikhail Teterin freebsd_committer freebsd_triage 2018-07-13 13:30:27 UTC
Created attachment 195110 [details]
The C file after preprocessing

Trying to update this port on FreeBSD 10.4-STABLE (clang-3.4.1) as of January 6:

cc -I/home/usr/ports/devel/libslang2/work/slang-2.3.2/src -shared -fPIC -O2 -pipe -march=nocona  -DLIBICONV_PLUG -fstack-protector -fno-strict-aliasing -I/home/usr/ports/devel/libslang2/work/slang-2.3.2/src -c /home/usr/ports/devel/libslang2/work/slang-2.3.2/modules/stats_kendall.c
cc: warning: argument unused during compilation: '-shared'
Stack dump:
0.      Program arguments: /usr/bin/cc -cc1 -triple i386-unknown-freebsd10.4 -emit-obj -disable-free -disable-llvm-verifier -main-file-name stats_kendall.c -mrelocation-model pic -pic-level 2 -mdisable-fp-elim -relaxed-aliasing -masm-verbose -mconstructor-aliases -target-cpu nocona -coverage-file /home/usr/ports/devel/libslang2/work/slang-2.3.2/modules/i386objs/stats_kendall.o -resource-dir /usr/bin/../lib/clang/3.4.1 -D LIBICONV_PLUG -I /home/usr/ports/devel/libslang2/work/slang-2.3.2/src -I /home/usr/ports/devel/libslang2/work/slang-2.3.2/src -O2 -fdebug-compilation-dir /home/usr/ports/devel/libslang2/work/slang-2.3.2/modules/i386objs -ferror-limit 19 -fmessage-length 80 -stack-protector 1 -mstackrealign -fobjc-runtime=gnustep -fdiagnostics-show-option -fcolor-diagnostics -vectorize-loops -vectorize-slp -o stats_kendall.o -x c /home/usr/ports/devel/libslang2/work/slang-2.3.2/modules/stats_kendall.c 
1.      <eof> parser at end of file
2.      Code generation
3.      Running pass 'Function Pass Manager' on module '/home/usr/ports/devel/libslang2/work/slang-2.3.2/modules/stats_kendall.c'.
4.      Running pass 'X86 DAG->DAG Instruction Selection' on function '@_pSLstats_kendall_tau'
cc: error: unable to execute command: Segmentation fault (core dumped)
cc: error: clang frontend command failed due to signal (use -v to see invocation)
FreeBSD clang version 3.4.1 (tags/RELEASE_34/dot1-final 208032) 20140512
Target: i386-unknown-freebsd10.4
Thread model: posix
cc: note: diagnostic msg: PLEASE submit a bug report to https://bugs.freebsd.org/submit/ and include the crash backtrace, preprocessed source, and associated run script.
cc: note: diagnostic msg: 
********************

PLEASE ATTACH THE FOLLOWING FILES TO THE BUG REPORT:
Preprocessed source(s) and associated run script(s) are located at:
cc: note: diagnostic msg: /tmp/stats_kendall-bc8f2f.c
cc: note: diagnostic msg: /tmp/stats_kendall-bc8f2f.sh
cc: note: diagnostic msg: 

********************
*** Error code 254

Stop.
make[4]: stopped in /home/usr/ports/devel/libslang2/work/slang-2.3.2/modules/i386objs
*** Error code 1


The above cited .c file is attached. The .sh is below:

 "/usr/bin/cc" -cc1 -triple i386-unknown-freebsd10.4 -emit-obj -disable-free -disable-llvm-verifier -main-file-name stats_kendall.c -mrelocation-model pic -pic-level 2 -mdisable-fp-elim -relaxed-aliasing -masm-verbose -mconstructor-aliases -target-cpu nocona -D "LIBICONV_PLUG" -O2 -ferror-limit 19 -fmessage-length 80 -stack-protector 1 -mstackrealign -fobjc-runtime=gnustep -fdiagnostics-show-option -fcolor-diagnostics -vectorize-loops -vectorize-slp -x c stats_kendall-bc8f2f.c


Quite possibly, a problem with the base (compiler), rather than the compiler, but the port-maintainer needs to know too...
Comment 1 Mikhail Teterin freebsd_committer freebsd_triage 2018-07-13 13:34:08 UTC
> Quite possibly, a problem with the base (compiler), rather than the compiler

Duh, rather than the *port* is what I meant, of course.

For the record:

 1. The port's options are:
    _OPTIONS_READ=libslang2-2.3.0
    _FILE_COMPLETE_OPTIONS_LIST=DOCS ICONV ONIG PCRE PNG
    OPTIONS_FILE_UNSET+=DOCS
    OPTIONS_FILE_SET+=ICONV
    OPTIONS_FILE_UNSET+=ONIG
    OPTIONS_FILE_SET+=PCRE
    OPTIONS_FILE_SET+=PNG
 2. The port built fine with CC=clang60
Comment 2 Dimitry Andric freebsd_committer freebsd_triage 2018-07-15 18:26:38 UTC
This seems to be fixed by https://reviews.llvm.org/rL211155, which landed first in clang 3.5.  I'm not sure if it makes sense to backport this fix to stable/10, since it is very unlikely any other releases are coming out, and packages will build against the last release.

Probably building with clang40 or higher should be enough to work around this.
Comment 3 Mikhail Teterin freebsd_committer freebsd_triage 2018-07-15 18:37:32 UTC
(In reply to Dimitry Andric from comment #2)
> I'm not sure if it makes sense to backport this fix to stable/10

Making stable more stable? Of course, it makes sense...

> packages will build against the last release.

So long as we keep publishing stable-10, I think, we ought to be fixing known problems.

> Probably building with clang40 or higher should be enough to work around this.

Yes, as I say in Comment #1, clang60 had no problem. Still, the base compiler ought to work too...
Comment 4 commit-hook freebsd_committer freebsd_triage 2018-07-17 21:11:03 UTC
A commit references this bug:

Author: dim
Date: Tue Jul 17 21:10:31 UTC 2018
New revision: 336429
URL: https://svnweb.freebsd.org/changeset/base/336429

Log:
  Pull in r211155 from upstream llvm trunk (by Tim Northover):

    DAG: move sret demotion into most basic LowerCallTo implementation.

    It looks like there are two versions of LowerCallTo here: the
    SelectionDAGBuilder one is designed to operate on LLVM IR, and the
    TargetLowering one in the case where everything is at DAG level.

    Previously, only the SelectionDAGBuilder variant could handle
    demoting an impossible return to sret semantics (before delegating to
    the TargetLowering version), but this functionality is also useful
    for certain libcalls (e.g. 128-bit operations on 32-bit x86).  So
    this commit moves the sret handling down a level.

    rdar://problem/17242889

  This should fix "Call result #3 has unhandled type i32" errors when
  building devel/libslang2 for i386.  Direct commit to stable/10, since
  clang 3.5 and later already have this change.

  Reported by:	mi
  PR:		229754

Changes:
  stable/10/contrib/llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp
Comment 5 Dimitry Andric freebsd_committer freebsd_triage 2018-07-17 21:14:06 UTC
Mikhail, can you please verify that it works for you after r336429?
Comment 6 Renato Botelho freebsd_committer freebsd_triage 2018-09-28 11:32:18 UTC
I couldn't reproduce it on a recent stable/10. If you can, please let me know and we re-open this issue