Opened 3 years ago

Last modified 3 years ago

#251 new defect

Array within tuple return crashes the compiler — at Initial Version

Reported by: Thierry Delisle Owned by:
Priority: minor Component: cfa-cc
Version: 1.0 Keywords:
Cc:

Description

[[] int, size_t] getarray() {
        int * a;
        size_t c;
        return [a, c];
}

That code crashes the compiler.

Null pointer (nullptr) dereference.                                                                                                                                                                                  
Stack back trace for: driver/cfa-cpp
(0) /lib/x86_64-linux-gnu/libc.so.6 : (/*unknown*/)+0x354c0 [0x7f1c0895b4c0]
(1) driver/cfa-cpp : ast::print(std::ostream&, ast::Node const*, Indenter)+0x31 [0xb19791]
(2) driver/cfa-cpp : ast::operator<<(std::ostream&, ast::Node const*)+0x18 [0xad73e8]
(3) driver/cfa-cpp : ast::ArrayIterator::ArrayIterator(CodeLocation const&, ast::ArrayType const*)+0x19f [0x154a2ef]
(4) driver/cfa-cpp : ast::createMemberIterator(CodeLocation const&, ast::Type const*)+0x169 [0x15428f9]
(5) driver/cfa-cpp : ast::CurrentObject::enterListInit(CodeLocation const&)+0x4a [0x1542bda]
(6) driver/cfa-cpp : ResolvExpr::Resolver_new::previsit(ast::ListInit const*)+0x2b [0x16a15db]
(7) driver/cfa-cpp : ast::Pass<ResolvExpr::Resolver_new>::visit(ast::ListInit const*)+0x92 [0x1731652]
(8) driver/cfa-cpp : ast::Pass<ResolvExpr::Resolver_new>::visit(ast::ObjectDecl const*)+0x1ae [0x172975e]
(9) driver/cfa-cpp : std::vector<ast::ptr_base<ast::Decl, (ast::Node::ref_type)0> > ast::Pass<ResolvExpr::Resolver_new>::call_accept<std::vector, ast::Decl>(std::vector<ast::ptr_base<ast::Decl, (ast::Node::ref_type)0> > const&)+0x119 [0x172b0e9]
(10) driver/cfa-cpp : ast::Pass<ResolvExpr::Resolver_new>::visit(ast::TupleType const*)+0x1b1 [0x172b4c1]
(11) driver/cfa-cpp : ast::Pass<ResolvExpr::Resolver_new>::visit(ast::ObjectDecl const*)+0x14c [0x17296fc]
(12) driver/cfa-cpp : std::vector<ast::ptr_base<ast::DeclWithType, (ast::Node::ref_type)0> > ast::Pass<ResolvExpr::Resolver_new>::call_accept<std::vector, ast::DeclWithType>(std::vector<ast::ptr_base<ast::DeclWithType, (ast::Node::ref_type)0> > const&)+0x119 [0x1729a29]
(13) driver/cfa-cpp : void ast::Pass<ResolvExpr::Resolver_new>::maybe_accept<ast::FunctionDecl, ast::FunctionDecl, std::vector<ast::ptr_base<ast::DeclWithType, (ast::Node::ref_type)0>, std::allocator<ast::ptr_base<ast::DeclWithType, (ast::Node::ref_type)0> > > >(ast::FunctionDecl const*&, std::vector<ast::ptr_base<ast::DeclWithType, (ast::Node::ref_type)0>, std::allocator<ast::ptr_base<ast::DeclWithType, (ast::Node::ref_type)0> > > ast::FunctionDecl::*)+0x42 [0x172a1a2]
(14) driver/cfa-cpp : ast::Pass<ResolvExpr::Resolver_new>::visit(ast::FunctionDecl const*)+0x1d5 [0x172a885]
(15) driver/cfa-cpp : void ast::Pass<ResolvExpr::Resolver_new>::run<>(ast::TranslationUnit&)+0x1dc [0x16e906c]
(16) driver/cfa-cpp : main(/*unknown*/)+0xa82 [0x9c9e82]
Stack back trace for: driver/cfa-cpp
(0) /lib/x86_64-linux-gnu/libc.so.6 : (/*unknown*/)+0x354c0 [0x7f1c0895b4c0]
(1) driver/cfa-cpp : ast::print(std::ostream&, ast::Node const*, Indenter)+0x31 [0xb19791]
(2) driver/cfa-cpp : ast::operator<<(std::ostream&, ast::Node const*)+0x18 [0xad73e8]
(3) driver/cfa-cpp : ast::ArrayIterator::ArrayIterator(CodeLocation const&, ast::ArrayType const*)+0x19f [0x154a2ef]
(4) driver/cfa-cpp : ast::createMemberIterator(CodeLocation const&, ast::Type const*)+0x169 [0x15428f9]
(5) driver/cfa-cpp : ast::CurrentObject::enterListInit(CodeLocation const&)+0x4a [0x1542bda]
(6) driver/cfa-cpp : ResolvExpr::Resolver_new::previsit(ast::ListInit const*)+0x2b [0x16a15db]
(7) driver/cfa-cpp : ast::Pass<ResolvExpr::Resolver_new>::visit(ast::ListInit const*)+0x92 [0x1731652]
(8) driver/cfa-cpp : ast::Pass<ResolvExpr::Resolver_new>::visit(ast::ObjectDecl const*)+0x1ae [0x172975e]
(9) driver/cfa-cpp : std::vector<ast::ptr_base<ast::Decl, (ast::Node::ref_type)0> > ast::Pass<ResolvExpr::Resolver_new>::call_accept<std::vector, ast::Decl>(std::vector<ast::ptr_base<ast::Decl, (ast::Node::ref_type)0> > const&)+0x119 [0x172b0e9]
(10) driver/cfa-cpp : ast::Pass<ResolvExpr::Resolver_new>::visit(ast::TupleType const*)+0x1b1 [0x172b4c1]
(11) driver/cfa-cpp : ast::Pass<ResolvExpr::Resolver_new>::visit(ast::ObjectDecl const*)+0x14c [0x17296fc]
(12) driver/cfa-cpp : std::vector<ast::ptr_base<ast::DeclWithType, (ast::Node::ref_type)0> > ast::Pass<ResolvExpr::Resolver_new>::call_accept<std::vector, ast::DeclWithType>(std::vector<ast::ptr_base<ast::DeclWithType, (ast::Node::ref_type)0> > const&)+0x119 [0x1729a29]
(13) driver/cfa-cpp : void ast::Pass<ResolvExpr::Resolver_new>::maybe_accept<ast::FunctionDecl, ast::FunctionDecl, std::vector<ast::ptr_base<ast::DeclWithType, (ast::Node::ref_type)0>, std::allocator<ast::ptr_base<ast::DeclWithType, (ast::Node::ref_type)0> > > >(ast::FunctionDecl const*&, std::vector<ast::ptr_base<ast::DeclWithType, (ast::Node::ref_type)0>, std::allocator<ast::ptr_base<ast::DeclWithType, (ast::Node::ref_type)0> > > ast::FunctionDecl::*)+0x42 [0x172a1a2]
(14) driver/cfa-cpp : ast::Pass<ResolvExpr::Resolver_new>::visit(ast::FunctionDecl const*)+0x1d5 [0x172a885]
(15) driver/cfa-cpp : void ast::Pass<ResolvExpr::Resolver_new>::run<>(ast::TranslationUnit&)+0x1dc [0x16e906c]
(16) driver/cfa-cpp : main(/*unknown*/)+0xa82 [0x9c9e82]

Change History (0)

Note: See TracTickets for help on using tickets.