[LLVMbugs] [Bug 13071] New: Crash on invalid with alloc_size attribute

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Sun Jun 10 02:35:30 PDT 2012


http://llvm.org/bugs/show_bug.cgi?id=13071

             Bug #: 13071
           Summary: Crash on invalid with alloc_size attribute
           Product: clang
           Version: trunk
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: -New Bugs
        AssignedTo: unassignedclangbugs at nondot.org
        ReportedBy: abramobagnara at tin.it
                CC: llvmbugs at cs.uiuc.edu
    Classification: Unclassified


$ cat ~/q.c
//typedef unsigned long size_t;
void* my_calloc(size_t, size_t) __attribute__((alloc_size(1,2)));

$ llvm-r158293-build/Debug+Asserts/bin/clang -c ~/q.c
/home/abramo/q.c:2:25: error: redefinition of parameter 'size_t'
void* my_calloc(size_t, size_t) __attribute__((alloc_size(1,2)));
                        ^
/home/abramo/q.c:2:17: error: a parameter list without types is only allowed in
      a function definition
void* my_calloc(size_t, size_t) __attribute__((alloc_size(1,2)));
                ^
clang:
/home/abramo/eclair_swi/deps/build/llvm-r158293/include/llvm/Support/Casting.h:194:
typename llvm::cast_retty<To, From>::ret_type llvm::cast(const Y&) [with X =
clang::ObjCMethodDecl, Y = const clang::Decl*, typename llvm::cast_retty<To,
From>::ret_type = const clang::ObjCMethodDecl*]: Assertion `isa<X>(Val) &&
"cast<Ty>() argument of incompatible type!"' failed.
0  clang     0x0000000002667131
1  clang     0x0000000002666f2d
2  libc.so.6 0x00007faa739024c0
3  libc.so.6 0x00007faa73902445 gsignal + 53
4  libc.so.6 0x00007faa73905bab abort + 379
5  libc.so.6 0x00007faa738fb10e
6  libc.so.6 0x00007faa738fb1b2
7  clang     0x0000000000e514c6 llvm::cast_retty<clang::ObjCMethodDecl,
clang::Decl const*>::ret_type llvm::cast<clang::ObjCMethodDecl, clang::Decl
const*>(clang::Decl const* const&) + 62
8  clang     0x00000000010ae418
9  clang     0x00000000010b20ca
10 clang     0x00000000010c1b56
11 clang     0x00000000010c26b4
12 clang     0x00000000010c2721
clang::Sema::ProcessDeclAttributeList(clang::Scope*, clang::Decl*,
clang::AttributeList const*, bool, bool) + 101
13 clang     0x00000000010c3555
clang::Sema::ProcessDeclAttributes(clang::Scope*, clang::Decl*,
clang::Declarator const&, bool, bool) + 699
14 clang     0x0000000001084914
clang::Sema::ActOnVariableDeclarator(clang::Scope*, clang::Declarator&,
clang::DeclContext*, clang::TypeSourceInfo*, clang::LookupResult&,
clang::ASTMultiPtr<clang::TemplateParameterList*>) + 3602
15 clang     0x0000000001082469 clang::Sema::HandleDeclarator(clang::Scope*,
clang::Declarator&, clang::ASTMultiPtr<clang::TemplateParameterList*>) + 2689
16 clang     0x000000000108126a clang::Sema::ActOnDeclarator(clang::Scope*,
clang::Declarator&) + 86
17 clang     0x0000000000f8f546
clang::Parser::ParseDeclarationAfterDeclaratorAndAttributes(clang::Declarator&,
clang::Parser::ParsedTemplateInfo const&) + 130
18 clang     0x0000000000f8ef40
clang::Parser::ParseDeclGroup(clang::ParsingDeclSpec&, unsigned int, bool,
clang::SourceLocation*, clang::Parser::ForRangeInit*) + 1178
19 clang     0x0000000000f801ac
clang::Parser::ParseDeclarationOrFunctionDefinition(clang::ParsingDeclSpec&,
clang::AccessSpecifier) + 1012
20 clang     0x0000000000f8023d
clang::Parser::ParseDeclarationOrFunctionDefinition(clang::ParsedAttributes&,
clang::AccessSpecifier) + 135
21 clang     0x0000000000f7f9f3
clang::Parser::ParseExternalDeclaration(clang::Parser::ParsedAttributesWithRange&,
clang::ParsingDeclSpec*) + 2599
22 clang     0x0000000000f7eef2
clang::Parser::ParseTopLevelDecl(clang::OpaquePtr<clang::DeclGroupRef>&) + 410
23 clang     0x0000000000f7b3e7 clang::ParseAST(clang::Sema&, bool, bool) + 631
24 clang     0x0000000000c3f1aa clang::ASTFrontendAction::ExecuteAction() + 298
25 clang     0x0000000000dcf33c clang::CodeGenAction::ExecuteAction() + 1194
26 clang     0x0000000000c3edde clang::FrontendAction::Execute() + 252
27 clang     0x0000000000c1961c
clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) + 718
28 clang     0x0000000000bec440
clang::ExecuteCompilerInvocation(clang::CompilerInstance*) + 969
29 clang     0x0000000000bdb023 cc1_main(char const**, char const**, char
const*, void*) + 999
30 clang     0x0000000000be77dd main + 494
31 libc.so.6 0x00007faa738ed76d __libc_start_main + 237
32 clang     0x0000000000bda289
Stack dump:
0.    Program arguments:
/home/abramo/eclair_swi/deps/build/llvm-r158293-build/Debug+Asserts/bin/clang
-cc1 -triple x86_64-unknown-linux-gnu -emit-obj -mrelax-all -disable-free
-main-file-name q.c -mrelocation-model static -mdisable-fp-elim -fmath-errno
-masm-verbose -mconstructor-aliases -munwind-tables -target-cpu x86-64
-target-linker-version 2.22 -momit-leaf-frame-pointer -coverage-file q.o
-resource-dir
/home/abramo/eclair_swi/deps/build/llvm-r158293-build/Debug+Asserts/bin/../lib/clang/3.2
-fmodule-cache-path /var/tmp/clang-module-cache -internal-isystem
/usr/local/include -internal-isystem
/home/abramo/eclair_swi/deps/build/llvm-r158293-build/Debug+Asserts/bin/../lib/clang/3.2/include
-internal-externc-isystem /usr/include/x86_64-linux-gnu
-internal-externc-isystem /include -internal-externc-isystem /usr/include
-fdebug-compilation-dir /home/abramo/eclair_swi/deps/build/llvm-r158293-build
-ferror-limit 19 -fmessage-length 80 -mstackrealign -fgnu-runtime
-fobjc-runtime-has-arc -fobjc-runtime-has-weak -fobjc-fragile-abi
-fdiagnostics-show-option -fcolor-diagnostics -o q.o -x c /home/abramo/q.c 
1.    /home/abramo/q.c:2:65: current parser token ';'
clang: error: unable to execute command: Aborted (core dumped)
clang: error: clang frontend command failed due to signal (use -v to see
invocation)
clang: note: diagnostic msg: Please submit a bug report to
http://llvm.org/bugs/ and include command line arguments and all diagnostic
information.
clang version 3.2 (trunk 158293)
Target: x86_64-unknown-linux-gnu
Thread model: posix
clang: note: diagnostic msg: Preprocessed source(s) and associated run
script(s) are located at:
clang: note: diagnostic msg: /tmp/q-a8PSKF.i
clang: note: diagnostic msg: /tmp/q-a8PSKF.sh

-- 
Configure bugmail: http://llvm.org/bugs/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.



More information about the llvm-bugs mailing list