llvm / llvm-project

The LLVM Project is a collection of modular and reusable compiler and toolchain technologies.
http://llvm.org
Other
28.06k stars 11.59k forks source link

crash of clang on riscv #65126

Closed andreasfink closed 1 year ago

andreasfink commented 1 year ago

a simple call to clang fails

root@uConsole-R01:~# clang-15 --version PLEASE submit a bug report to https://github.com/llvm/llvm-project/issues/ and include the crash backtrace, preprocessed source, and associated run script. Stack dump:

  1. Program arguments: clang-15 --version
  2. Compilation construction

    0 0x0000003fc3f91654 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/usr/lib/llvm-15/bin/../lib/libLLVM-15.so.1+0xea2654)

    Illegal instruction

root@uConsole-R01:~# clang-14 --version PLEASE submit a bug report to https://github.com/llvm/llvm-project/issues/ and include the crash backtrace, preprocessed source, and associated run script. Stack dump:

  1. Program arguments: clang-14 --version
  2. Compilation construction

    0 0x0000003fd3b206ee llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/lib/riscv64-linux-gnu/libLLVM-14.so.1+0xe196ee)

    Illegal instruction

root@uConsole-R01:~# cd /etc root@uConsole-R01:/etc# cat os-release PRETTY_NAME="Ubuntu 22.04.3 LTS" NAME="Ubuntu" VERSION_ID="22.04" VERSION="22.04.3 LTS (Jammy Jellyfish)" VERSION_CODENAME=jammy ID=ubuntu ID_LIKE=debian HOME_URL="https://www.ubuntu.com/" SUPPORT_URL="https://help.ubuntu.com/" BUG_REPORT_URL="https://bugs.launchpad.net/ubuntu/" PRIVACY_POLICY_URL="https://www.ubuntu.com/legal/terms-and-policies/privacy-policy" UBUNTU_CODENAME=jammy root@uConsole-R01:/etc# arch riscv64 root@uConsole-R01:/etc# uname -a Linux uConsole-R01 5.4.61+ #6 PREEMPT Tue Jun 13 11:14:26 CST 2023 riscv64 riscv64 riscv64 GNU/Linux

EugeneZelenko commented 1 year ago

Please try 17 Release Candidate or main? https://godbolt.org should be helpful.

andreasfink commented 1 year ago

the official repository only has 11,12,13,14,15. None of them works. How can someone build an official release over 5 generations and none of them works and it is not detected?

andreasfink commented 1 year ago

and why should https://godbolt.org/ be helpful. I'm not even compiling code yet.. im only asking the tool for its version number. Thats so basic that there must be something very very deeply wrong in the very early stage.

EugeneZelenko commented 1 year ago

Only most recent release branch (17) is maintained.

andreasfink commented 1 year ago

so you are saying the riscv version was packaged into debian packages since release 11 and nobody ever noticed that none of them ever work? I don't think so. recompiling it will take several days...

andreasfink commented 1 year ago

so far as to get release 17

N: Skipping acquire of configured file 'main/binary-riscv64/Packages' as repository 'http://apt.llvm.org/jammy llvm-toolchain-jammy-17 InRelease' doesn't support architecture 'riscv64'

efriedma-quic commented 1 year ago

The issue you're seeing might actually be an illegal instruction. What CPU are you running on? Does it support rv64gc? If you attach gdb to clang, which instruction is causing the crash?

andreasfink commented 1 year ago

yes its illegal instruction. Its a uConsole from clockworkPi. Their CPU module is called R01.

@.*** afink]# cat /proc/cpuinfo processor : 0 hart : 0 isa : rv64imafdcvu mmu : sv39

@.*** afink]#

Andreas Fink

Paradieshofstr 101, 4054 Basel, Switzerland Mobile: +41-78-6677333 Office: +41-61-6666330 Skype: andreasfink Twitter @kiwi66

On Donnerstag, Aug. 31, 2023 at 7:21 PM, Eli Friedman @. @.)> wrote:

The issue you're seeing might actually be an illegal instruction. What CPU are you running on? Does it support rv64gc? If you attach gdb to clang, which instruction is causing the crash?

— Reply to this email directly, view it on GitHub (https://github.com/llvm/llvm-project/issues/65126#issuecomment-1701450131), or unsubscribe (https://github.com/notifications/unsubscribe-auth/ACTTOPBZJDBCBOIKJVSI5PDXYDBYHANCNFSM6AAAAAA4FHHPIY). You are receiving this because you authored the thread.Message ID: @.***>

efriedma-quic commented 1 year ago

Looks like a duplicate of #50090 ; there's a hardware bug in Allwinner D1 CPUs handling the fence.tso instruction. I think there might be a workaround for the issue in newer kernels; try a newer version of Ubuntu.

llvmbot commented 1 year ago

@llvm/issue-subscribers-backend-risc-v