Bug 215603

Summary: clang: crash on i386 when compiling math/cgal
Product: Base System Reporter: Dmitry Marakasov <amdmi3>
Component: binAssignee: Dmitry Marakasov <amdmi3>
Status: Closed FIXED    
Severity: Affects Some People    
Priority: ---    
Version: 11.0-RELEASE   
Hardware: Any   
OS: Any   
Attachments:
Description Flags
Source
none
sh
none
Log none

Description Dmitry Marakasov freebsd_committer freebsd_triage 2016-12-27 10:48:50 UTC
Created attachment 178315 [details]
Source

If USE_GCC is removed from math/cgal, it crashes on 11+ i386.

*** Bad machine code: MBB exits via unconditional fall-through but its successor differs from its CFG successor! ***
- function:    _Z19Reech2DTriLin4x4_u8PvPiS_S0_Pd
- basic block: BB#11 if.then29 (0x2ef0d6ac)

*** Bad machine code: MBB exits via unconditional fall-through but its successor differs from its CFG successor! ***
- function:    _Z19Reech2DTriLin4x4_u8PvPiS_S0_Pd
- basic block: BB#14 if.then43 (0x2ef0d764)

*** Bad machine code: Using an undefined physical register ***
- function:    _Z19Reech2DTriLin4x4_u8PvPiS_S0_Pd
- basic block: BB#19 if.then56 (0x2ef0d878)
- instruction: FNSTSW16r
- operand 1:   %FPSW<imp-use>

*** Bad machine code: MBB exits via unconditional fall-through but its successor differs from its CFG successor! ***
- function:    _Z19Reech2DTriLin4x4_u8PvPiS_S0_Pd
- basic block: BB#24 if.then98 (0x2ef0d98c)

*** Bad machine code: MBB exits via unconditional fall-through but its successor differs from its CFG successor! ***
- function:    _Z19Reech2DTriLin4x4_u8PvPiS_S0_Pd
- basic block: BB#25 if.end99 (0x2ef0d9e8)
fatal error: error in backend: Found 5 machine code errors.
c++: error: clang frontend command failed with exit code 70 (use -v to see invocation)
FreeBSD clang version 3.8.0 (tags/RELEASE_380/final 262564) (based on LLVM 3.8.0)
Target: i386-unknown-freebsd11.0
Thread model: posix
InstalledDir: /usr/bin
c++: 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.
c++: note: diagnostic msg: 
********************

PLEASE ATTACH THE FOLLOWING FILES TO THE BUG REPORT:
Preprocessed source(s) and associated run script(s) are located at:
c++: note: diagnostic msg: /tmp/all_files-0a1123.cpp
c++: note: diagnostic msg: /tmp/all_files-0a1123.sh
c++: note: diagnostic msg: 

********************
Comment 1 Dmitry Marakasov freebsd_committer freebsd_triage 2016-12-27 10:49:22 UTC
Created attachment 178316 [details]
sh
Comment 2 Dmitry Marakasov freebsd_committer freebsd_triage 2016-12-27 10:50:04 UTC
Created attachment 178317 [details]
Log
Comment 3 Dimitry Andric freebsd_committer freebsd_triage 2016-12-27 14:46:32 UTC
In head and stable/11, where we now have clang 3.9.1, this crash does not occur anymore.  It was fixed by upstream llvm r265547 [1] some time after 3.8.0 came out, but that commit is pretty big, and it apparently introduced its own problems, because it was reverted and re-applied a few times.

I'm unsure what to do about this problem now.  It is tricky to patch, and if the default was already USE_GCC, we could only disable this for __FreeBSD_versions >= 1200017 and >= 1100508.

[1] http://llvm.org/viewvc/llvm-project?view=revision&revision=265547
Comment 4 Dmitry Marakasov freebsd_committer freebsd_triage 2016-12-27 15:00:11 UTC
(In reply to Dimitry Andric from comment #3)

> In head and stable/11, where we now have clang 3.9.1, this crash does not
> occur anymore.  It was fixed by upstream llvm r265547 [1] some time after
> 3.8.0 came out, but that commit is pretty big, and it apparently introduced
> its own problems, because it was reverted and re-applied a few times.
> 
> I'm unsure what to do about this problem now.  It is tricky to patch, and if
> the default was already USE_GCC, we could only disable this for
> __FreeBSD_versions >= 1200017 and >= 1100508.
> 
> [1] http://llvm.org/viewvc/llvm-project?view=revision&revision=265547

Well my primary goal was to report the problem. As long as it's fixed in newer clang we can add conditionals to the ports. I'll handle it then, thank you!
Comment 5 Dmitry Marakasov freebsd_committer freebsd_triage 2016-12-28 18:55:07 UTC
math/cgal fixed by using clang 3.9