Chapel: nil checking on error-handling

Created on 23 Jun 2019  路  5Comments  路  Source: chapel-lang/chapel

Summary of Problem

Calling a method on a generic error within a catch block results in a nil-checking error.

Steps to Reproduce

Source Code:

proc hello() {
  try {
    writeln('hello');
  } catch e {
    writeln(e.message());
  }
}

hello();
nilCheck.chpl:1: In function 'hello':
nilCheck.chpl:5: error: attempt to dereference nil
nilCheck.chpl:2: note: this statement may be relevant

Configuration Information

  • Output of chpl --version: chpl version 1.20.0 pre-release (775dd4ff11)
Compiler Bug

All 5 comments

@mppf - this is the error I was talking to you about offline.

See also #11918

This impacts some application code, but it is not a gating issue b/c a work-around exists:

proc hello() {
  try {
    writeln('hello');
  } catch e {
    var error = e: Error;
    writeln(error.message());
  }
}

hello();

@ben-albrecht - I'm expecting @vasslitvinov's PR #13314 to fix it.

Right. See:

test/classes/nilability/catch-no-throw.chpl
Was this page helpful?
0 / 5 - 0 ratings