Opened 4 months ago

#260 new defect

comparing signal return value crashes

Reported by: Thierry Delisle Owned by:
Priority: major Component: cfa-cc
Version: 1.0 Keywords: crash, formal type
Cc:

Description

The following code crashes the compiler:

#include <signal.h>
typedef void (*sighandler_t)(int);
void dummy(int) {}

int main() {
        sighandler_t ret = signal(SIGTERM, dummy);
        if(ret != SIG_ERR) return 1;
}

The output error is :

CFA Version 1.0.0 (debug)
*CFA assertion error* "aftype" from program "cfa-cpp" in "bool GenPoly::needsTupleSpecialization(Type *, Type *)" at line 133 in file "../../main/src/GenPoly/Specialize.cc": formal type is a function type, but actual type is not: signed int
Stack back trace for: /home/tdelisle/workspace/cforall/build/driver/cfa-cpp
(0) /home/tdelisle/workspace/cforall/build/driver/cfa-cpp : GenPoly::needsTupleSpecialization(Type*, Type*)+0x1b7 [0x11bbdc7]
(1) /home/tdelisle/workspace/cforall/build/driver/cfa-cpp : GenPoly::Specialize::doSpecialization(Type*, Expression*, std::map<unsigned int, ParamEntry, std::less<unsigned int>, std::allocator<std::pair<unsigned int const, ParamEntry> > >*)+0x3f [0x11bbe5f]
(2) /home/tdelisle/workspace/cforall/build/driver/cfa-cpp : PassVisitor<GenPoly::Specialize>::mutate(CastExpr*)+0xc6 [0x11c54a6]
(3) /home/tdelisle/workspace/cforall/build/driver/cfa-cpp : void maybeMutate_impl<std::__cxx11::list<Expression*, std::allocator<Expression*> >, GenPoly::Specialize>(std::__cxx11::list<Expression*, std::allocator<Expression*> >&, PassVisitor<GenPoly::Specialize>&)+0xcb [0x11ce7db]
(4) /home/tdelisle/workspace/cforall/build/driver/cfa-cpp : PassVisitor<GenPoly::Specialize>::mutate(ApplicationExpr*)+0x9a [0x11c4f2a]
(5) /home/tdelisle/workspace/cforall/build/driver/cfa-cpp : void maybeMutate_impl<std::__cxx11::list<Expression*, std::allocator<Expression*> >, GenPoly::Specialize>(std::__cxx11::list<Expression*, std::allocator<Expression*> >&, PassVisitor<GenPoly::Specialize>&)+0xcb [0x11ce7db]
(6) /home/tdelisle/workspace/cforall/build/driver/cfa-cpp : PassVisitor<GenPoly::Specialize>::mutate(ApplicationExpr*)+0x9a [0x11c4f2a]
(7) /home/tdelisle/workspace/cforall/build/driver/cfa-cpp : PassVisitor<GenPoly::Specialize>::mutate(IfStmt*)+0x49 [0x11c42c9]
(8) /home/tdelisle/workspace/cforall/build/driver/cfa-cpp : void PassVisitor<GenPoly::Specialize>::handleStatementList<PassVisitor<GenPoly::Specialize>::mutateStatementList(std::__cxx11::list<Statement*, std::allocator<Statement*> >&)::{lambda(Statement*&)#1}>(std::__cxx11::list<Statement*, std::allocator<Statement*> >&, PassVisitor<GenPoly::Specialize>::mutateStatementList(std::__cxx11::list<Statement*, std::allocator<Statement*> >&)::{lambda(Statement*&)#1})+0x275 [0x11ce2c5]
(9) /home/tdelisle/workspace/cforall/build/driver/cfa-cpp : non-virtual thunk to PassVisitor<GenPoly::Specialize>::mutate(CompoundStmt*)+0x36 [0x11c8a56]
(10) /home/tdelisle/workspace/cforall/build/driver/cfa-cpp : PassVisitor<GenPoly::Specialize>::mutate(FunctionDecl*)+0xa7 [0x11c3667]
(11) /home/tdelisle/workspace/cforall/build/driver/cfa-cpp : void mutateAll<GenPoly::Specialize>(std::__cxx11::list<Declaration*, std::allocator<Declaration*> >&, PassVisitor<GenPoly::Specialize>&)+0xed [0x11bd29d]
(12) /home/tdelisle/workspace/cforall/build/driver/cfa-cpp : GenPoly::convertSpecializations(std::__cxx11::list<Declaration*, std::allocator<Declaration*> >&)+0xa0 [0x11bcc40]
(13) /home/tdelisle/workspace/cforall/build/driver/cfa-cpp : main(/*unknown*/)+0x2541 [0x9852a1]

Change History (0)

Note: See TracTickets for help on using tickets.