chapel-lang/chapel — pull request #580 by bradcray (2014-09-29 18:48:09+00:00)
Title: Found and fixed a bug in the glob() routine

It turns out that when I moved Tim's glob() routine into the
Filerator.chpl module, I changed a c_int return type of
chpl_glob_num() to a size_t to better reflect the C interface.
However, in doing so, I also introduced an error because we iterated
over the range:

0..chpl_glob_num(...)-1

which, for a glob() call with no matches, resulted in:

0..0:uint(64)-1

or:

0..max(uint(64))

which is a range that we generate overflow warnings for. In Tim's
original code, this just resulted in 0..-1 which wasn't an issue.

This commit fixes the bug by checking against '0' before entering the
loop over the range. It also files a few test cases that exercised
the bug and updates the output of the globberator.good file to
reflect the new tests.