Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/InitTweak/FixInit.cc

    rddae809 re41306d  
    501501                }
    502502
    503                 // to prevent warnings (‘_unq0’ may be used uninitialized in this function),
    504                 // insert an appropriate zero initializer for UniqueExpr temporaries.
    505                 Initializer * makeInit( Type * t ) {
    506                         if ( StructInstType * inst = dynamic_cast< StructInstType * >( t ) ) {
    507                                 // initizer for empty struct must be empty
    508                                 if ( inst->baseStruct->members.empty() ) return new ListInit({});
    509                         } else if ( UnionInstType * inst = dynamic_cast< UnionInstType * >( t ) ) {
    510                                 // initizer for empty union must be empty
    511                                 if ( inst->baseUnion->members.empty() ) return new ListInit({});
    512                         }
    513 
    514                         return new ListInit( { new SingleInit( new ConstantExpr( Constant::from_int( 0 ) ) ) } );
    515                 }
    516 
    517503                void ResolveCopyCtors::postvisit( UniqueExpr * unqExpr ) {
    518504                        if ( vars.count( unqExpr->get_id() ) ) {
     
    529515                        } else {
    530516                                // expr isn't a call expr, so create a new temporary variable to use to hold the value of the unique expression
    531                                 unqExpr->set_object( ObjectDecl::newObject( toString("_unq", unqExpr->get_id()), unqExpr->get_result()->clone(), makeInit( unqExpr->get_result() ) ) );
     517                                unqExpr->set_object( ObjectDecl::newObject( toString("_unq", unqExpr->get_id()), unqExpr->get_result()->clone(), nullptr ) );
    532518                                unqExpr->set_var( new VariableExpr( unqExpr->get_object() ) );
    533519                        }
Note: See TracChangeset for help on using the changeset viewer.