lowRISC / lowRISC/riscv-llvm

Clang for RISC-V 32/64 bits crashes on __c11_atomic_*_fence() with variable memory order

Open
#49 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Shell
Stars
277
Forks
55
PR merge metrics
No merged PRs in 30d

Description

Hi there,

The following piece of code:

```
int main(int argc, char **argv) {
__c11_atomic_signal_fence(argc);
}
```

causes Clang r318692 with today's patches to crash as follows:

```
fatal error: error in backend: Cannot select: 0x8066806e8: ch = AtomicFence 0x80661cc40, Constant:i64<7>,
Constant:i64<0>
0x806680548: i64 = Constant<7>
0x806680068: i64 = Constant<0>
In function: main
clang-6.0: error: clang frontend command failed with exit code 70 (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-aa1f6f.c
clang-6.0: note: diagnostic msg: /tmp/bla-aa1f6f.sh
clang-6.0: note: diagnostic msg:

********************
```

Best regards,
Ed

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the crash by compiling the shown C snippet with Clang r318692 for the riscv64-unknown-cloudabi target. Start from the __c11_atomic_signal_fence call and the backend's AtomicFence selection failure; done means this variable-memory-order fence no longer causes a compiler crash.

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.