Skip to content

ICE with alias attribute and placeholder for return type deduction #33335

Open
@hubert-reinterpretcast

Description

@hubert-reinterpretcast
Bugzilla Link 33988
Version trunk
OS All
CC @AaronBallman,@hfinkel

Extended Description

Clang ICEs when an alias is defined using a placeholder type.

SOURCE ():

extern "C" auto bar() { return 0; }
auto f() __attribute__((__alias__("bar")));

COMPILER INVOCATION:

clang++ -cc1 -triple x86_64-unknown-linux-gnu -emit-llvm -o /dev/null -x c++ -std=c++14 -

ACTUAL OUTPUT:

<stdin>:1:17: warning: 'bar' has C-linkage specified, but returns user-defined type 'auto' which is incompatible with C
extern "C" auto bar() { return 0; }
                ^
#&#8203;0 0x00000000019f9454 PrintStackTraceSignalHandler(void*) (/opt/wandbox/clang-head/bin/clang+++0x19f9454)
#&#8203;1 0x00000000019f9726 SignalHandler(int) (/opt/wandbox/clang-head/bin/clang+++0x19f9726)
#&#8203;2 0x00007f3e34096390 __restore_rt (/lib/x86_64-linux-gnu/libpthread.so.0+0x11390)
#&#8203;3 0x0000000001626c0a llvm::FunctionType::get(llvm::Type*, llvm::ArrayRef<llvm::Type*>, bool) (/opt/wandbox/clang-head/bin/clang+++0x1626c0a)
#&#8203;4 0x0000000001c83e97 clang::CodeGen::CodeGenTypes::GetFunctionType(clang::CodeGen::CGFunctionInfo const&) (/opt/wandbox/clang-head/bin/clang+++0x1c83e97)
#&#8203;5 0x0000000001c127d4 clang::CodeGen::CodeGenTypes::ConvertFunctionType(clang::QualType, clang::FunctionDecl const*) (/opt/wandbox/clang-head/bin/clang+++0x1c127d4)
#&#8203;6 0x0000000001c10df0 clang::CodeGen::CodeGenTypes::ConvertType(clang::QualType) (/opt/wandbox/clang-head/bin/clang+++0x1c10df0)
#&#8203;7 0x0000000001c10be0 clang::CodeGen::CodeGenTypes::ConvertTypeForMem(clang::QualType) (/opt/wandbox/clang-head/bin/clang+++0x1c10be0)
#&#8203;8 0x0000000001bc9a51 clang::CodeGen::CodeGenModule::EmitAliasDefinition(clang::GlobalDecl) (/opt/wandbox/clang-head/bin/clang+++0x1bc9a51)
#&#8203;9 0x0000000001bccaf6 clang::CodeGen::CodeGenModule::EmitTopLevelDecl(clang::Decl*) (/opt/wandbox/clang-head/bin/clang+++0x1bccaf6)
#&#8203;10 0x00000000021c2d8f (anonymous namespace)::CodeGeneratorImpl::HandleTopLevelDecl(clang::DeclGroupRef) (/opt/wandbox/clang-head/bin/clang+++0x21c2d8f)
#&#8203;11 0x00000000021c0553 clang::BackendConsumer::HandleTopLevelDecl(clang::DeclGroupRef) (/opt/wandbox/clang-head/bin/clang+++0x21c0553)
#&#8203;12 0x000000000264bc74 clang::ParseAST(clang::Sema&, bool, bool) (/opt/wandbox/clang-head/bin/clang+++0x264bc74)
#&#8203;13 0x0000000001ed7f0f clang::FrontendAction::Execute() (/opt/wandbox/clang-head/bin/clang+++0x1ed7f0f)
#&#8203;14 0x0000000001e99ab8 clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) (/opt/wandbox/clang-head/bin/clang+++0x1e99ab8)
#&#8203;15 0x0000000001f610ee clang::ExecuteCompilerInvocation(clang::CompilerInstance*) (/opt/wandbox/clang-head/bin/clang+++0x1f610ee)
#&#8203;16 0x0000000000851ff2 cc1_main(llvm::ArrayRef<char const*>, char const*, void*) (/opt/wandbox/clang-head/bin/clang+++0x851ff2)
#&#8203;17 0x0000000000850f18 main (/opt/wandbox/clang-head/bin/clang+++0x850f18)
#&#8203;18 0x00007f3e32e05830 __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x20830)
#&#8203;19 0x000000000084de79 _start (/opt/wandbox/clang-head/bin/clang+++0x84de79)
Stack dump:
0.      Program arguments: /opt/wandbox/clang-head/bin/clang++ -cc1 -triple x86_64-unknown-linux-gnu -emit-llvm -o /dev/null -x c++ -std=c++14 -
1.      <eof> parser at end of file
2.      <stdin>:2:6: LLVM IR generation of declaration 'f'

EXPECTED OUTPUT:

(clean compile)

COMPILER VERSION INFO (clang++ -v):

clang version 6.0.0 (https://github.com/llvm-mirror/clang.git 7617352ce7f8b221d531dce1f95f2ee78e57cfac) (https://github.com/llvm-mirror/llvm.git 38e69b8dcf7aa24ceaf101ea2cde4d1f8f47ecb0)
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir: /opt/wandbox/clang-head/bin
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/5
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/5.4.0
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/6
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/6.0.0
Selected GCC installation: /usr/lib/gcc/x86_64-linux-gnu/5.4.0
Candidate multilib: .;@m64
Selected multilib: .;@m64

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugzillaIssues migrated from bugzillac++14clang:codegenIR generation bugs: mangling, exceptions, etc.confirmedVerified by a second partycrash-on-valid

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions