Out intent error on [] real versus real confusion

The code below,

const nC = 5;
var xbar,ybar: [1..nC] real;
for C in 1..nC do {
   // -----------------------------------------------------------------
   // The eigenvalues.
   // -----------------------------------------------------------------
   var lambda1 = 10.0;
   // -----------------------------------------------------------------
   // Find the ellipse for each cluster.
   // -----------------------------------------------------------------
   ErrorTest(lambda1,xbar,ybar);
}
proc ErrorTest(
   const in lambda1: real,
   out xbar: real,
   out ybar: real) {
   xbar = lambda1;
   ybar = lambda1 + 1.0;
}

Produces an error message that is somewhat cryptic:

trials$ chpl outerror.chpl
outerror.chpl:11: internal error: AST-FOR-LLS-01346 chpl version 2.8.0
Note: This source location is a guess.

Internal errors indicate a bug in the Chapel compiler,
and we're sorry for the hassle.  We would appreciate your reporting this bug --
please see https://chapel-lang.org/bugs.html for instructions.  In the meantime,
the filename + line number above may be useful in working around the issue.

The error itself is not hard to spot: the procedure call should have been

ErrorTest(lambda1,xbar[C],ybar[C]);

However, I expected the compiler to identify the error in the type passed ([ ] real instead of real) and to issue an error message about the wrong type being used. Could this be a compiler bug?

Regards

Nelson

Hi Nelson —

We consider any internal error to be a bug, yes. Please feel encouraged to open a GitHub issue for this.

-Brad

Github issue posted.

1 Like

Thanks Nelson!

Here's the issue for future readers who might find their way here:

-Brad