New Issue: compiler seg faults in BaseAST::typeInfo

18923, "jhh67", "compiler seg faults in BaseAST::typeInfo", "2022-01-06T17:46:50Z"

Summary of Problem

Compiler seg faults in BaseAST::typeInfo when compiling the program below

Steps to Reproduce

Source Code:

class Node {
    var size: int = 0;
    var left: Node = nil;
    var right: Node = nil;
}

var root: Node = new Node();

Compile command:

chpl foo.chpl

Execution command:

NA

Associated Future Test(s):

Configuration Information

  • Output of chpl --version:
chpl version 1.26.0 pre-release (8ea37a3c68)
Copyright 2020-2021 Hewlett Packard Enterprise Development LP
Copyright 2004-2019 Cray Inc.
(See LICENSE file for more details)
  • Output of $CHPL_HOME/util/printchplenv --anonymize:
CHPL_TARGET_PLATFORM: darwin
CHPL_TARGET_COMPILER: clang *
CHPL_TARGET_ARCH: x86_64
CHPL_TARGET_CPU: unknown *
CHPL_LOCALE_MODEL: flat
CHPL_COMM: none *
CHPL_TASKS: qthreads
CHPL_LAUNCHER: none
CHPL_TIMERS: generic
CHPL_UNWIND: none
CHPL_MEM: jemalloc
CHPL_ATOMICS: cstdlib
CHPL_GMP: none *
CHPL_HWLOC: bundled
CHPL_RE2: bundled *
CHPL_LLVM: none *
CHPL_AUX_FILESYS: none

  • Back-end compiler and version, e.g. gcc --version or clang --version:
Apple clang version 12.0.0 (clang-1200.0.32.29)
Target: x86_64-apple-darwin19.6.0
Thread model: posix
InstalledDir: /Library/Developer/CommandLineTools/usr/bin
  • (For Cray systems only) Output of module list:
  • Debug Info
(lldb) run
Process 14691 launched: '/Users/jhh/git/chapel-lang/main/bin/darwin-x86_64/chpl' (x86_64)
Process 14691 stopped
* thread #1, queue = 'com.apple.main-thread', stop reason = EXC_BAD_ACCESS (code=1, address=0x0)
    frame #0: 0x000000010008ee80 chpl`BaseAST::typeInfo(this=0x0000000000000000) at baseAST.cpp:419:28
   416   }
   417
   418   Type* BaseAST::typeInfo() {
-> 419     QualifiedType qt = this->qualType();
   420     return qt.type();
   421   }
   422
Target 0: (chpl) stopped.
(lldb) p this
(BaseAST *) $0 = 0x0000000000000000
(lldb) bt
* thread #1, queue = 'com.apple.main-thread', stop reason = EXC_BAD_ACCESS (code=1, address=0x0)
  * frame #0: 0x000000010008ee80 chpl`BaseAST::typeInfo(this=0x0000000000000000) at baseAST.cpp:419:28
    frame #1: 0x000000010008f265 chpl`BaseAST::getValType(this=0x0000000000000000) at baseAST.cpp:458:16
    frame #2: 0x000000010056df8f chpl`moveFinalize(call=0x00000001109e9d30) at functionResolution.cpp:8053:31
    frame #3: 0x000000010056da82 chpl`resolveMoveForRhsCallExpr(call=0x00000001109e9d30, rhsType=0x0000000000000000) at functionResolution.cpp:7907:5
    frame #4: 0x0000000100541349 chpl`resolveMove(call=0x00000001109e9d30) at functionResolution.cpp:7574:7
    frame #5: 0x0000000100537d7e chpl`resolveCall(call=0x00000001109e9d30) at functionResolution.cpp:2627:7
    frame #6: 0x000000010054b35f chpl`resolveExprPhase2(origExpr=0x00000001109e9d30, fn=0x00000001109e90b0, expr=0x00000001109e9d30) at functionResolution.cpp:8897:5
    frame #7: 0x000000010054850d chpl`resolveExpr(expr=0x00000001109e9d30) at functionResolution.cpp:8816:14
    frame #8: 0x000000010054ad99 chpl`resolveBlockStmt(blockStmt=0x00000001109e9450) at functionResolution.cpp:8737:12
    frame #9: 0x0000000100691460 chpl`buildDefaultedActualFn(fn=0x00000001109e4ec0, formal=0x00000001109e56f0) at wrappers.cpp:733:3
    frame #10: 0x000000010068c3d0 chpl`getOrCreateDefaultedActualFnEntry(fn=0x00000001109e4ec0, formal=0x00000001109e56f0) at wrappers.cpp:795:41
    frame #11: 0x000000010068f6cc chpl`createDefaultedActual(fn=0x00000001109e4ec0, formal=0x00000001109e56f0, call=0x00000001109db390, body=0x00000001109e9000, copyMap=0x00007ffeefbfd628) at wrappers.cpp:819:31
    frame #12: 0x000000010068a36a chpl`handleDefaultArg(fn=0x00000001109e4ec0, call=0x00000001109db390, formal=0x00000001109e56f0, actual=0x00000001109e7740, copyMap=0x00007ffeefbfd628, resolveNewCode=true) at wrappers.cpp:417:23
    frame #13: 0x0000000100688284 chpl`wrapAndCleanUpActuals(fn=0x00000001109e4ec0, info=0x00007ffeefbfda68, actualIdxToFormal=size=4, fastFollowerChecks=true) at wrappers.cpp:225:9
    frame #14: 0x000000010056210e chpl`wrapAndCleanUpActuals(best=0x00000001109e4e00, info=0x00007ffeefbfda68, followerChecks=true) at functionResolution.cpp:4020:14
    frame #15: 0x000000010055a965 chpl`resolveNormalCall(info=0x00007ffeefbfda68, checkState=CHECK_NORMAL_CALL, best=0x00000001109e4e00) at functionResolution.cpp:3684:14
    frame #16: 0x0000000100557ac0 chpl`resolveNormalCall(info=0x00007ffeefbfda68, checkState=CHECK_NORMAL_CALL) at functionResolution.cpp:3653:14
    frame #17: 0x0000000100542e6f chpl`resolveNormalCall(call=0x00000001109db390, checkState=CHECK_NORMAL_CALL) at functionResolution.cpp:3348:16
    frame #18: 0x0000000100542cb7 chpl`resolveNormalCall(call=0x00000001109db390) at functionResolution.cpp:2704:10
    frame #19: 0x0000000100537e4a chpl`resolveCall(call=0x00000001109db390) at functionResolution.cpp:2667:5
    frame #20: 0x000000010054b35f chpl`resolveExprPhase2(origExpr=0x00000001109db390, fn=0x00000001032fafb0, expr=0x00000001109db390) at functionResolution.cpp:8897:5
    frame #21: 0x000000010054850d chpl`resolveExpr(expr=0x00000001109db390) at functionResolution.cpp:8816:14
    frame #22: 0x000000010054ad99 chpl`resolveBlockStmt(blockStmt=0x00000001109db1a0) at functionResolution.cpp:8737:12
    frame #23: 0x0000000100592c58 chpl`resolveNewInitializer(newExpr=0x000000010b4d15e0, manager=0x00000001032106f0) at initializerResolution.cpp:433:5
    frame #24: 0x000000010056f069 chpl`resolveNewWithInitializer(newExpr=0x000000010b4d15e0, manager=0x00000001032106f0) at functionResolution.cpp:8387:3
    frame #25: 0x0000000100541462 chpl`resolveNew(newExpr=0x000000010b4d15e0) at functionResolution.cpp:8148:9
    frame #26: 0x0000000100537d9a chpl`resolveCall(call=0x000000010b4d15e0) at functionResolution.cpp:2635:7
    frame #27: 0x000000010054b35f chpl`resolveExprPhase2(origExpr=0x000000010b4d15e0, fn=0x00000001032fafb0, expr=0x000000010b4d15e0) at functionResolution.cpp:8897:5
    frame #28: 0x000000010054850d chpl`resolveExpr(expr=0x000000010b4d15e0) at functionResolution.cpp:8816:14
    frame #29: 0x000000010054ad99 chpl`resolveBlockStmt(blockStmt=0x00000001032fb1c0) at functionResolution.cpp:8737:12
    frame #30: 0x0000000100643bf6 chpl`resolveFunction(fn=0x00000001032fafb0, forCall=0x0000000000000000) at resolveFunction.cpp:547:7
    frame #31: 0x0000000100643942 chpl`resolveSignatureAndFunction(fn=0x00000001032fafb0) at resolveFunction.cpp:88:3
    frame #32: 0x000000010054c768 chpl`resolveUses(mod=0x0000000106be4be0, path="") at functionResolution.cpp:9597:5
    frame #33: 0x000000010054b79a chpl`resolve() at functionResolution.cpp:9441:3
    frame #34: 0x00000001002b35b1 chpl`runPass(tracker=0x00007ffeefbfe980, passIndex=12, isChpldoc=false) at runpasses.cpp:208:3
    frame #35: 0x00000001002b342e chpl`runPasses(tracker=0x00007ffeefbfe980, isChpldoc=false) at runpasses.cpp:170:5
    frame #36: 0x00000001002a6e8b chpl`main(argc=2, argv=0x00007ffeefbfe9f0) at driver.cpp:1756:3
    frame #37: 0x00007fff73339cc9 libdyld.dylib`start + 1
(lldb) quit