Changeset f6cc734e


Ignore:
Timestamp:
Jul 22, 2019, 4:13:38 PM (5 years ago)
Author:
Michael Brooks <mlbrooks@…>
Branches:
ADT, arm-eh, ast-experimental, enum, forall-pointer-decay, jacob/cs343-translation, master, new-ast, new-ast-unique-expr, pthread-emulation, qualifiedEnum
Children:
4eb43fa
Parents:
99da267
Message:

Fixing new-resolver bug with incorrectly reused FunctionType? pieces in old-model AST after convert-back. (See code comments for detail.) Symptom was crash (with pure virtual method call, due to double delete) during InstantiateGeneric? pass on Bootloader. Now libcfa build progresses to next file, src/prelude.o.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/AST/Convert.cpp

    r99da267 rf6cc734e  
    607607
    608608                tgt->result = get<Type>().accept1(src->result);
     609                // Unconditionally use a clone of the result type.
     610                // We know this will leak some objects: much of the immediate conversion result.
     611                // In some cases, using the conversion result directly gives unintended object sharing.
     612                // A parameter (ObjectDecl, a child of a FunctionType) is shared by the weak-ref cache.
     613                // But tgt->result must be fully owned privately by tgt.
     614                // Applying these conservative copies here means
     615                // - weak references point at the declaration's copy, not these expr.result copies (good)
     616                // - we copy more objects than really needed (bad, tolerated)
     617                if (tgt->result) {
     618                        tgt->result = tgt->result->clone();
     619                }
    609620                return visitBaseExpr_skipResultType(src, tgt);
    610621        }
Note: See TracChangeset for help on using the changeset viewer.