Changeset 30651b0 for src


Ignore:
Timestamp:
Jun 3, 2015, 11:20:17 PM (9 years ago)
Author:
Rob Schluntz <rschlunt@…>
Branches:
ADT, aaron-thesis, arm-eh, ast-experimental, cleanup-dtors, ctor, deferred_resn, demangler, enum, forall-pointer-decay, gc_noraii, jacob/cs343-translation, jenkins-sandbox, master, memory, new-ast, new-ast-unique-expr, new-env, no_list, persistent-indexer, pthread-emulation, qualifiedEnum, resolv-new, string, with_gc
Children:
1136d96, a61fea9a
Parents:
c3a4385
Message:

added necessary null check to array dimension resolver code

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/ResolvExpr/Resolver.cc

    rc3a4385 r30651b0  
    159159
    160160                if ( ArrayType * at = dynamic_cast< ArrayType * >( new_type ) ){
    161                         BasicType arrayLenType = BasicType( Type::Qualifiers(), BasicType::LongUnsignedInt );
    162                         CastExpr *castExpr = new CastExpr( at->get_dimension(), arrayLenType.clone() );
    163                         Expression *newExpr = findSingleExpression( castExpr, *this );
    164                         delete at->get_dimension();
    165                         at->set_dimension( newExpr );
     161                        if ( at->get_dimension() ) {
     162                                BasicType arrayLenType = BasicType( Type::Qualifiers(), BasicType::LongUnsignedInt );
     163                                CastExpr *castExpr = new CastExpr( at->get_dimension(), arrayLenType.clone() );
     164                                Expression *newExpr = findSingleExpression( castExpr, *this );
     165                                delete at->get_dimension();
     166                                at->set_dimension( newExpr );
     167                        }
    166168                }
    167169        }
Note: See TracChangeset for help on using the changeset viewer.