Changeset 8cbf8cd


Ignore:
Timestamp:
Sep 22, 2015, 2:05:29 PM (6 years ago)
Author:
Rob Schluntz <rschlunt@…>
Branches:
aaron-thesis, arm-eh, cleanup-dtors, ctor, deferred_resn, demangler, gc_noraii, jacob/cs343-translation, jenkins-sandbox, master, memory, new-ast, new-ast-unique-expr, new-env, no_list, persistent-indexer, resolv-new, string, with_gc
Children:
d0d9610
Parents:
2f9956b
Message:

added some list emptiness checks in Specialize.cc

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/GenPoly/Specialize.cc

    r2f9956b r8cbf8cd  
    99// Author           : Richard C. Bilson
    1010// Created On       : Mon May 18 07:44:20 2015
    11 // Last Modified By : Peter A. Buhr
    12 // Last Modified On : Sat Jun 13 15:54:07 2015
    13 // Update Count     : 6
     11// Last Modified By : Rob Schluntz
     12// Last Modified On : Tue Sep 22 14:04:13 2015
     13// Update Count     : 15
    1414//
    1515
     
    8686
    8787        Expression * Specialize::doSpecialization( Type *formalType, Expression *actual, InferredParams *inferParams ) {
     88                assert( ! actual->get_results().empty() );
    8889                if ( needsSpecialization( formalType, actual->get_results().front(), env ) ) {
    8990                        PointerType *ptrType;
     
    167168        Expression * Specialize::mutate( AddressExpr *addrExpr ) {
    168169                addrExpr->get_arg()->acceptMutator( *this );
     170                assert( ! addrExpr->get_results().empty() );
    169171                addrExpr->set_arg( doSpecialization( addrExpr->get_results().front(), addrExpr->get_arg() ) );
    170172                return addrExpr;
     
    173175        Expression * Specialize::mutate( CastExpr *castExpr ) {
    174176                castExpr->get_arg()->acceptMutator( *this );
    175                 castExpr->set_arg( doSpecialization( castExpr->get_results().front(), castExpr->get_arg() ) );
     177                if ( ! castExpr->get_results().empty() ) {
     178                        // this may not be the correct condition, but previously the next statement
     179                        // was happening unchecked, causing a crash on a cast to void
     180                        castExpr->set_arg( doSpecialization( castExpr->get_results().front(), castExpr->get_arg() ) );         
     181                }
    176182                return castExpr;
    177183        }
Note: See TracChangeset for help on using the changeset viewer.