[llvm-bugs] [Bug 44904] New: Compiler crash for lowering c++ complex type on RISCV

via llvm-bugs llvm-bugs at lists.llvm.org
Fri Feb 14 01:10:38 PST 2020


https://bugs.llvm.org/show_bug.cgi?id=44904

            Bug ID: 44904
           Summary: Compiler crash for lowering c++ complex type on RISCV
           Product: clang
           Version: trunk
          Hardware: PC
                OS: Windows NT
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: LLVM Codegen
          Assignee: unassignedclangbugs at nondot.org
          Reporter: tclin914 at gmail.com
                CC: llvm-bugs at lists.llvm.org, neeilans at live.com,
                    richard-llvm at metafoo.co.uk

Testcase (from gcc testsuite g++.dg/torture/pr39678.C)
----------
struct Y {};                                                                   
                                                                               
            struct X {
  struct Y y;
  __complex__ float val;
};

struct X __attribute__((noinline))
foo (float *p)
{
  struct X x;
  __real x.val = p[0];
  __imag x.val = p[1];
  return x;
}
extern "C" void abort (void);
float a[2] = { 3., -2. };
int main()
{
  struct X x = foo(a);
  if (__real x.val != 3. || __imag x.val != -2.)
    abort ();
  return 0;
}

Execution command
----------
clang -target riscv32 -march=rv32ifd -mabi=ilp32f pr39678.C -S -O2 -o -

clang:
/fast-playground2/jim/llvm-trunk/llvm-project/clang/lib/CodeGen/TargetInfo.cpp:9502:
bool {anonymous}::RISCVABIInfo::detectFPCCEligibleStructHelper(clang::QualType, 
clang::CharUnits, llvm::Type*&, clang::CharUnits&, llvm::Type*&,
clang::CharUnits&) const: Assertion `CurOff.isZero() && "Unexpected offset for
first field"' failed.
Stack dump:
0.      Program arguments:
/fast-playground2/jim/llvm-trunk/llvm-project-build/bin/clang -target riscv32
-march=rv32ifd -mabi=ilp32f pr39678.C -S -O2 -o -
1.      pr39678.C:18:1: current parser token 'extern'
2.      pr39678.C:11:1: LLVM IR generation of declaration 'foo'
3.      pr39678.C:11:1: Generating code for declaration 'foo'
 #0 0x00000000044e72f8 llvm::sys::PrintStackTrace(llvm::raw_ostream&)
/fast-playground2/jim/llvm-trunk/llvm-project/llvm/lib/Support/Unix/Signals.inc:564:0
 #1 0x00000000044e738b PrintStackTraceSignalHandler(void*)
/fast-playground2/jim/llvm-trunk/llvm-project/llvm/lib/Support/Unix/Signals.inc:625:0
 #2 0x00000000044e541c llvm::sys::RunSignalHandlers()
/fast-playground2/jim/llvm-trunk/llvm-project/llvm/lib/Support/Signals.cpp:68:0
 #3 0x00000000044e6c2e llvm::sys::CleanupOnSignal(unsigned long)
/fast-playground2/jim/llvm-trunk/llvm-project/llvm/lib/Support/Unix/Signals.inc:361:0
 #4 0x000000000441240c (anonymous
namespace)::CrashRecoveryContextImpl::HandleCrash(int, unsigned long)
/fast-playground2/jim/llvm-trunk/llvm-project/llvm/lib/Support/CrashRecoveryContext.cpp:77:0
 #5 0x0000000004412877 CrashRecoverySignalHandler(int)
/fast-playground2/jim/llvm-trunk/llvm-project/llvm/lib/Support/CrashRecoveryContext.cpp:383:0
 #6 0x00007f3e30ed8890 __restore_rt
(/lib/x86_64-linux-gnu/libpthread.so.0+0x12890)
 #7 0x00007f3e2ff22e97 raise
/build/glibc-OTsEL5/glibc-2.27/signal/../sysdeps/unix/sysv/linux/raise.c:51:0
 #8 0x00007f3e2ff24801 abort /build/glibc-OTsEL5/glibc-2.27/stdlib/abort.c:81:0
 #9 0x00007f3e2ff1439a __assert_fail_base
/build/glibc-OTsEL5/glibc-2.27/assert/assert.c:89:0
#10 0x00007f3e2ff14412 (/lib/x86_64-linux-gnu/libc.so.6+0x30412)
#11 0x0000000004a0f474 (anonymous
namespace)::RISCVABIInfo::detectFPCCEligibleStructHelper(clang::QualType,
clang::CharUnits, llvm::Type*&, clang::CharUnits&, llvm::Type*&,
 clang::CharUnits&) const
/fast-playground2/jim/llvm-trunk/llvm-project/clang/lib/CodeGen/TargetInfo.cpp:9502:0 
...

Thanks.
Jim.

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20200214/4b6bb6db/attachment.html>


More information about the llvm-bugs mailing list