__builtin_flt_rounds() crashes on riscv64
Nobody has claimed this yet.
- Dominant language
- Shell
- Stars
- 277
- Forks
- 55
- PR merge metrics
- No merged PRs in 30d
Description
I thought you might be interested in this bug report. I've observed that the following code:
```
int main() {
return __builtin_flt_rounds();
}
```
Causes Clang r318692 to crash as follows:
```
08:50:29 ed@x ~ $ riscv64-unknown-cloudabi-cc -o bla bla.c
#0 0x0000000001a82748 llvm::sys::PrintStackTrace(llvm::raw_ostream&) (/usr/local/riscv-llvm/bin/clang-6.0+0x1a82748)
#1 0x0000000001a82cf6 SignalHandler(int) (/usr/local/riscv-llvm/bin/clang-6.0+0x1a82cf6)
#2 0x00000008047288f6 handle_signal /usr/src/lib/libthr/thread/thr_sig.c:0:3
#3 0x0000000804727e9f thr_sighandler /usr/src/lib/libthr/thread/thr_sig.c:190:1
Stack dump:
0. Program arguments: /usr/local/riscv-llvm/bin/clang-6.0 -cc1 -triple riscv64-unknown-cloudabi -emit-obj -mrelax-all -disable-free -disable-llvm-verifier -discard-value-names -main-file-name bla.c -mrelocation-model static -mthread-model posix -mdisable-fp-elim -masm-verbose -mconstructor-aliases -target-abi lp64 -dwarf-column-info -debugger-tuning=gdb -ffunction-sections -fdata-sections -resource-dir /usr/local/riscv-llvm/lib/clang/6.0.0 -fdebug-compilation-dir /home/ed -ferror-limit 19 -fmessage-length 177 -fsanitize=safe-stack -fno-signed-char -fobjc-runtime=gnustep -fdiagnostics-show-option -fcolor-diagnostics -o /tmp/bla-8c659e.o -x c bla.c
1. parser at end of file
2. Code generation
3. Running pass 'Function Pass Manager' on module 'bla.c'.
4. Running pass 'RISCV DAG->DAG Pattern Instruction Selection' on function '@main'
clang-6.0: error: unable to execute command: Segmentation fault (core dumped)
clang-6.0: error: clang frontend command failed due to signal (use -v to see invocation)
clang version 6.0.0 (trunk 318692)
Target: riscv64-unknown-cloudabi
Thread model: posix
InstalledDir: /usr/local/bin
clang-6.0: note: diagnostic msg: PLEASE submit a bug report to http://llvm.org/bugs/ and include the crash backtrace, preprocessed source, and associated run script.
clang-6.0: note: diagnostic msg:
********************
PLEASE ATTACH THE FOLLOWING FILES TO THE BUG REPORT:
Preprocessed source(s) and associated run script(s) are located at:
clang-6.0: note: diagnostic msg: /tmp/bla-f7f5ca.c
clang-6.0: note: diagnostic msg: /tmp/bla-f7f5ca.sh
clang-6.0: note: diagnostic msg:
********************
```
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Reproduce the crash with the provided bla.c program and the riscv64-unknown-cloudabi-cc command. Start at the RISCV DAG->DAG Pattern Instruction Selection pass for main, using the reported stack dump and generated preprocessed source or run script if available. Done means the compiler no longer crashes when compiling __builtin_flt_rounds().
Written by the indexing model from the issue text.
Assessment
- Tech stack
- c
- Domain
- compilers
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100