New Issue: reader and writer channels don't error with a good message when their start is higher than their end

20524, "lydia-duncan", "reader and writer channels don't error with a good message when their start is higher than their end", "2022-08-26T16:39:55Z"

Summary of Problem

It is obviously not correct to try to create a reader or writer channel that ends before it starts. However, it would be better to detect this and generate a helpful error message on their creation with a region like this instead of just segfaulting.

Steps to Reproduce

Source Code:

use IO;

var filename = "openreaderLimited.txt";
var readCh = openreader(filename, region=3..0);  // Pretty sure this also happens with file.reader and file.writer
var readRes: string;
readCh.readLine(readRes, stripNewline=true);
writeln(readRes);
readCh.close();

Compile command:
chpl foo.chpl

Execution command:
./foo
Requires the specified file exists, but I don't think the contents matter.

Associated Future Test(s):
test/library/standard/IO/openreaderBadRegion2.chpl #20475

Configuration Information

  • Output of chpl --version: chpl 1.28.0 pre-release
  • Output of $CHPL_HOME/util/printchplenv --anonymize: any
  • Back-end compiler and version, e.g. gcc --version or clang --version: any
  • (For Cray systems only) Output of module list: N/A