[llvm-bugs] [Bug 35164] New: WASM: Assertion taking address of struct (unknown size)

via llvm-bugs llvm-bugs at lists.llvm.org
Wed Nov 1 15:13:06 PDT 2017


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

            Bug ID: 35164
           Summary: WASM: Assertion taking address of struct (unknown
                    size)
           Product: clang
           Version: trunk
          Hardware: PC
                OS: Windows NT
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: -New Bugs
          Assignee: unassignedclangbugs at nondot.org
          Reporter: john at csquare.ca
                CC: llvm-bugs at lists.llvm.org

This only repros with -target wasm32-unknown-unknown-wasm.

Sample file:
struct EXT_STRUCT;
extern struct EXT_STRUCT instance;

int main()
{
    return (int)&instance;
}

Clang should not need the size in order to return the address.

Repro:
john at DESKTOP-42MHL48:~/testwebasm$ clang-6.0 externstruct.c -target
wasm32-unknown-unknown-wasm --sysroot /home/john/wasm_sysroot/ -c
clang-6.0: /home/john/llvm/include/llvm/IR/DataLayout.h:533: uint64_t
llvm::DataLayout::getTypeSizeInBits(llvm::Type *) const: Assertion
`Ty->isSized() && "Cannot getTypeInfo() on a type that is unsized!"' failed.

#0 0x000000000239484c llvm::sys::PrintStackTrace(llvm::raw_ostream&)
/home/john/llvm/lib/Support/Unix/Signals.inc:398:0
#1 0x00000000023949f9 PrintStackTraceSignalHandler(void*)
/home/john/llvm/lib/Support/Unix/Signals.inc:462:0
#2 0x0000000002392ee3 llvm::sys::RunSignalHandlers()
/home/john/llvm/lib/Support/Signals.cpp:50:0
#3 0x000000000239508f SignalHandler(int)
/home/john/llvm/lib/Support/Unix/Signals.inc:252:0
#4 0x00007fc20c5f0330 __restore_rt
(/lib/x86_64-linux-gnu/libpthread.so.0+0x10330)
#5 0x00007fc20b196c37 gsignal
/build/eglibc-SvCtMH/eglibc-2.19/signal/../nptl/sysdeps/unix/sysv/linux/raise.c:56:0
#6 0x00007fc20b19a028 abort
/build/eglibc-SvCtMH/eglibc-2.19/stdlib/abort.c:91:0
#7 0x00007fc20b18fbf6 __assert_fail_base
/build/eglibc-SvCtMH/eglibc-2.19/assert/assert.c:92:0
#8 0x00007fc20b18fca2 (/lib/x86_64-linux-gnu/libc.so.6+0x2fca2)
#9 0x0000000000e0652f llvm::DataLayout::getTypeSizeInBits(llvm::Type*) const
/home/john/llvm/include/llvm/IR/DataLayout.h:534:0
#10 0x0000000000e06c2d llvm::DataLayout::getTypeStoreSize(llvm::Type*) const
/home/john/llvm/include/llvm/IR/DataLayout.h:389:0
#11 0x0000000000e06b4f llvm::DataLayout::getTypeAllocSize(llvm::Type*) const
/home/john/llvm/include/llvm/IR/DataLayout.h:407:0
#12 0x000000000122e407
llvm::WebAssemblyAsmPrinter::EmitEndOfAsmFile(llvm::Module&)
/home/john/llvm/lib/Target/WebAssembly/WebAssemblyAsmPrinter.cpp:93:23
#13 0x000000000304de4e llvm::AsmPrinter::doFinalization(llvm::Module&)
/home/john/llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp:1414:0
#14 0x0000000001bff55c llvm::FPPassManager::doFinalization(llvm::Module&)
/home/john/llvm/lib/IR/LegacyPassManager.cpp:1553:0
#15 0x0000000001bffe92 (anonymous
namespace)::MPPassManager::runOnModule(llvm::Module&)
/home/john/llvm/lib/IR/LegacyPassManager.cpp:1609:0
#16 0x0000000001bff6fb llvm::legacy::PassManagerImpl::run(llvm::Module&)
/home/john/llvm/lib/IR/LegacyPassManager.cpp:1694:0
#17 0x0000000001c00151 llvm::legacy::PassManager::run(llvm::Module&)
/home/john/llvm/lib/IR/LegacyPassManager.cpp:1725:0
#18 0x00000000026bebc3 (anonymous
namespace)::EmitAssemblyHelper::EmitAssembly(clang::BackendAction,
std::unique_ptr<llvm::raw_pwrite_stream,
std::default_delete<llvm::raw_pwrite_stream> >)
/home/john/llvm/tools/clang/lib/CodeGen/BackendUtil.cpp:794:0
#19 0x00000000026bc20f clang::EmitBackendOutput(clang::DiagnosticsEngine&,
clang::HeaderSearchOptions const&, clang::CodeGenOptions const&,
clang::TargetOptions const&, clang::LangOptions const&, llvm::DataLayout
const&, llvm::Module*, clang::BackendAction,
std::unique_ptr<llvm::raw_pwrite_stream,
std::default_delete<llvm::raw_pwrite_stream> >)
/home/john/llvm/tools/clang/lib/CodeGen/BackendUtil.cpp:1145:0
#20 0x000000000346fe31
clang::BackendConsumer::HandleTranslationUnit(clang::ASTContext&)
/home/john/llvm/tools/clang/lib/CodeGen/CodeGenAction.cpp:292:0
#21 0x0000000004550950 clang::ParseAST(clang::Sema&, bool, bool)
/home/john/llvm/tools/clang/lib/Parse/ParseAST.cpp:161:0
#22 0x0000000002e6a68e clang::ASTFrontendAction::ExecuteAction()
/home/john/llvm/tools/clang/lib/Frontend/FrontendAction.cpp:1000:0
#23 0x000000000346d1f7 clang::CodeGenAction::ExecuteAction()
/home/john/llvm/tools/clang/lib/CodeGen/CodeGenAction.cpp:1032:0
#24 0x0000000002e6a0c8 clang::FrontendAction::Execute()
/home/john/llvm/tools/clang/lib/Frontend/FrontendAction.cpp:901:0
#25 0x0000000002df57a4
clang::CompilerInstance::ExecuteAction(clang::FrontendAction&)
/home/john/llvm/tools/clang/lib/Frontend/CompilerInstance.cpp:992:0
#26 0x0000000002fef63e
clang::ExecuteCompilerInvocation(clang::CompilerInstance*)
/home/john/llvm/tools/clang/lib/FrontendTool/ExecuteCompilerInvocation.cpp:252:0
#27 0x0000000000dbeffc cc1_main(llvm::ArrayRef<char const*>, char const*,
void*) /home/john/llvm/tools/clang/tools/driver/cc1_main.cpp:221:0
#28 0x0000000000db1e11 ExecuteCC1Tool(llvm::ArrayRef<char const*>,
llvm::StringRef) /home/john/llvm/tools/clang/tools/driver/driver.cpp:309:0
#29 0x0000000000db0a91 main
/home/john/llvm/tools/clang/tools/driver/driver.cpp:388:0
#30 0x00007fc20b181f45 __libc_start_main
/build/eglibc-SvCtMH/eglibc-2.19/csu/libc-start.c:321:0
#31 0x0000000000daf854 _start (/usr/local/bin/clang-6.0+0xdaf854)
Stack dump:
0.      Program arguments: /usr/local/bin/clang-6.0 -cc1 -triple
wasm32-unknown-unknown-wasm -emit-obj -mrelax-all -disable-free -main-file-name
externstruct.c -mrelocation-model static -mthread-model posix -masm-verbose
-mconstructor-aliases -fuse-init-array -target-cpu generic -fvisibility hidden
-dwarf-column-info -debugger-tuning=gdb -momit-leaf-frame-pointer
-ffunction-sections -fdata-sections -coverage-notes-file
/home/john/testwebasm/externstruct.gcno -resource-dir
/usr/local/lib/clang/6.0.0 -isysroot /home/john/wasm_sysroot/ -internal-isystem
/home/john/wasm_sysroot//include -fdebug-compilation-dir /home/john/testwebasm
-ferror-limit 19 -fmessage-length 120 -fobjc-runtime=gnustep -fno-common
-fdiagnostics-show-option -fcolor-diagnostics -o externstruct.o -x c
externstruct.c
1.      <eof> parser at end of file
2.      Code generation
clang-6.0: error: unable to execute command: Aborted (core dumped)
clang-6.0: error: clang frontend command failed due to signal (use -v to see
invocation)
clang version 6.0.0 (trunk 316824)
Target: wasm32-unknown-unknown-wasm
Thread model: posix
InstalledDir: /usr/local/bin

-- 
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/20171101/b6339e6c/attachment-0001.html>


More information about the llvm-bugs mailing list