Changeset b3ab8f0 for src/GenPoly/Box.cc


Ignore:
Timestamp:
Apr 6, 2016, 5:03:29 PM (8 years ago)
Author:
Aaron Moss <a3moss@…>
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:
bc1ab61
Parents:
2a76297
Message:

Fix boxing error on comma expressions

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/GenPoly/Box.cc

    r2a76297 rb3ab8f0  
    904904                                        return;
    905905                                } else if ( arg->get_results().front()->get_isLvalue() ) {
    906                                         // VariableExpr and MemberExpr are lvalues
    907                                         arg = new AddressExpr( arg );
     906                                        // VariableExpr and MemberExpr are lvalues; need to check this isn't coming from the second arg of a comma expression though (not an lvalue)
     907                                        if ( CommaExpr *commaArg = dynamic_cast< CommaExpr* >( arg ) ) {
     908                                                // hoist first half of expression and return second
     909                                                stmtsToAdd.push_back( new ExprStmt( noLabels, commaArg->get_arg1() ) );
     910                                                arg = new AddressExpr( commaArg->get_arg2() );
     911                                               
     912                                                commaArg->set_arg1( 0 );
     913                                                commaArg->set_arg2( 0 );
     914                                                delete commaArg;
     915                                        } else {
     916                                                arg = new AddressExpr( arg );
     917                                        }
    908918                                } else {
    909919                                        // use type computed in unification to declare boxed variables
     
    10001010                        } // for
    10011011                }
    1002 
    1003 
    10041012
    10051013                FunctionDecl *Pass1::makeAdapter( FunctionType *adaptee, FunctionType *realType, const std::string &mangleName, const TyVarMap &tyVars ) {
Note: See TracChangeset for help on using the changeset viewer.