[llvm-bugs] [Bug 35358] New: GlobalISel: Assertion `SizeInBits != 0 && "invalid zero-sized type"' failed.

via llvm-bugs llvm-bugs at lists.llvm.org
Mon Nov 20 02:51:49 PST 2017


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

            Bug ID: 35358
           Summary: GlobalISel: Assertion `SizeInBits != 0 && "invalid
                    zero-sized type"' failed.
           Product: libraries
           Version: trunk
          Hardware: PC
                OS: All
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: GlobalISel
          Assignee: unassignedbugs at nondot.org
          Reporter: kristof.beyls at arm.com
                CC: llvm-bugs at lists.llvm.org

$ cat small.ll
target datalayout = "e-m:e-i8:8:32-i16:16:32-i64:64-i128:128-n32:64-S128"
target triple = "aarch64--linux-gnu"

%struct.T1 = type { float, %struct.T3 }
%struct.T3 = type {}

define %struct.T1 @fn1() {
entry:
  %retval = alloca %struct.T1, align 4
  %agg.tmp = alloca %struct.T1, align 4
  %call = call %struct.T1 @fn1()
  %0 = getelementptr inbounds %struct.T1, %struct.T1* %agg.tmp, i32 0, i32 0
  %1 = extractvalue %struct.T1 %call, 0
  store float %1, float* %0, align 4
  %2 = getelementptr inbounds %struct.T1, %struct.T1* %agg.tmp, i32 0, i32 1
  %3 = extractvalue %struct.T1 %call, 1
  store %struct.T3 %3, %struct.T3* %2, align 4
  %4 = load %struct.T1, %struct.T1* %retval, align 4
  ret %struct.T1 %4
}
$ llc -global-isel small.ll
llc: /home/kribey01/dev/llvm.org/llvm/lib/CodeGen/LowLevelType.cpp:34:
llvm::LLT llvm::getLLTForType(llvm::Type &, const llvm::DataLayout &):
Assertion `SizeInBits != 0 && "invalid zero-sized type"' failed.
#0 0x0000000002db5d54 PrintStackTraceSignalHandler(void*)
(/home/kribey01/dev/llvm.org/build/bin/llc+0x2db5d54)
#1 0x0000000002db6076 SignalHandler(int)
(/home/kribey01/dev/llvm.org/build/bin/llc+0x2db6076)
#2 0x00007f531a23b340 __restore_rt
(/lib/x86_64-linux-gnu/libpthread.so.0+0x10340)
#3 0x00007f5318e1ecc9 gsignal
/build/eglibc-3GlaMS/eglibc-2.19/signal/../nptl/sysdeps/unix/sysv/linux/raise.c:56:0
#4 0x00007f5318e220d8 abort
/build/eglibc-3GlaMS/eglibc-2.19/stdlib/abort.c:91:0
#5 0x00007f5318e17b86 __assert_fail_base
/build/eglibc-3GlaMS/eglibc-2.19/assert/assert.c:92:0
#6 0x00007f5318e17c32 (/lib/x86_64-linux-gnu/libc.so.6+0x2fc32)
#7 0x000000000246e6f5 llvm::getLLTForType(llvm::Type&, llvm::DataLayout const&)
(/home/kribey01/dev/llvm.org/build/bin/llc+0x246e6f5)
#8 0x0000000002fea6b2 llvm::IRTranslator::getOrCreateVReg(llvm::Value const&)
(/home/kribey01/dev/llvm.org/build/bin/llc+0x2fea6b2)
#9 0x0000000002fed33d llvm::IRTranslator::translateExtractValue(llvm::User
const&, llvm::MachineIRBuilder&)
(/home/kribey01/dev/llvm.org/build/bin/llc+0x2fed33d)
#10 0x0000000002ff1de9 llvm::IRTranslator::translate(llvm::Instruction const&)
(/home/kribey01/dev/llvm.org/build/bin/llc+0x2ff1de9)
#11 0x0000000002ff2878
llvm::IRTranslator::runOnMachineFunction(llvm::MachineFunction&)
(/home/kribey01/dev/llvm.org/build/bin/llc+0x2ff2878)
#12 0x00000000024c4174
llvm::MachineFunctionPass::runOnFunction(llvm::Function&)
(/home/kribey01/dev/llvm.org/build/bin/llc+0x24c4174)
#13 0x00000000027c25bf llvm::FPPassManager::runOnFunction(llvm::Function&)
(/home/kribey01/dev/llvm.org/build/bin/llc+0x27c25bf)
#14 0x00000000027c2813 llvm::FPPassManager::runOnModule(llvm::Module&)
(/home/kribey01/dev/llvm.org/build/bin/llc+0x27c2813)
#15 0x00000000027c2d06 llvm::legacy::PassManagerImpl::run(llvm::Module&)
(/home/kribey01/dev/llvm.org/build/bin/llc+0x27c2d06)
#16 0x00000000016aab62 compileModule(char**, llvm::LLVMContext&)
(/home/kribey01/dev/llvm.org/build/bin/llc+0x16aab62)
#17 0x00000000016a817b main
(/home/kribey01/dev/llvm.org/build/bin/llc+0x16a817b)
#18 0x00007f5318e09ec5 __libc_start_main
/build/eglibc-3GlaMS/eglibc-2.19/csu/libc-start.c:321:0
#19 0x00000000016a7029 _start
(/home/kribey01/dev/llvm.org/build/bin/llc+0x16a7029)
Stack dump:
0.      Program arguments: /home/kribey01/dev/llvm.org/build/bin/llc
-global-isel small.ll
1.      Running pass 'Function Pass Manager' on module 'small.ll'.
2.      Running pass 'IRTranslator' on function '@fn1'
Aborted (core dumped)

The C input that produced the above LLVM-IR is:
$ cat small.c
typedef struct {
} T3;
typedef struct {
  float field0;
  T3 field1
} T1;
T1 fn1() { fn1(); }
with clang command line:
clang --target=aarch64-linux-gnu -S small.c -emit-llvm -o small.ll

This was found by running the ABITest testing framework in clang's util
directory:
// ../ABITestGen.py --no-unsigned --no-vector --no-complex --no-bool --max-args
0 -o inputs/test.4874.a.c -T inputs/test.4874.b.c -D inputs/test.4874.driver.c
--min=4874 --count=1
// Generated: 2017-11-17 14:52
// Cardinality of function generator: inf
// Cardinality of type generator: inf

#include <stdio.h>
#include <string.h>
#include <assert.h>

typedef union T3 {  } T3;
typedef struct T1 { float field0; T3 field1; } T1;
extern T1 T1_retval;
T1 fn4874(void);
static T1 T1_values[] = {
        { 0.0f, { } },
        { -1.0f, { } },
        { 1.0f, { } },
        { -1.0f, { } },
};
void test_fn4874(void) {
  printf("fn4874: testing return.\n");
  for (int i=0; i<4; ++i) {
    T1 RV;
    T1_retval = T1_values[i];
    RV = fn4874();
    printf("  fn4874_RV: RV.field0 = %f\n", RV.field0);
    printf("  fn4874_RV: RV.field1 (empty)\n");
    assert(RV.field0 == T1_values[i].field0);
  }
}

-- 
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/20171120/a6d96aee/attachment-0001.html>


More information about the llvm-bugs mailing list