Conversion of an empty string to int results in a run-time
error (as expected) with a useful error message:
error: Empty string when converting from string to int(64)
while conversion of an empty string to real results
in segmentation fault:
Segmentation fault: 11
Source Code:
config var s: string;
// var x = s: int; // this results in a run-time error with a clear message
var x = s: real; // this results in segmentation fault
writeln( "s = ", s );
writeln( "x = ", x );
Compile command:
chpl -o a.out test.chpl
Execution command:
./a.out gives the segmentation error for conversion to real(64).
./a.out --s=7 works as expected:
s = 7
x = 7.0
./a.out --s= (no input) gives the following run-time error (with a clear message):
<command-line arg>:1: error: Configuration variable 's' is missing its initialization value
Output of chpl --version:
chpl Version 1.16.0
Copyright (c) 2004-2017, Cray Inc. (See LICENSE file for more details)
Output of $CHPL_HOME/util/printchplenv --anonymize:
CHPL_TARGET_PLATFORM: darwin
CHPL_TARGET_COMPILER: gnu +
CHPL_TARGET_ARCH: native
CHPL_LOCALE_MODEL: flat
CHPL_COMM: none
CHPL_TASKS: qthreads
CHPL_LAUNCHER: none
CHPL_TIMERS: generic
CHPL_UNWIND: none
CHPL_MEM: jemalloc
CHPL_MAKE: make
CHPL_ATOMICS: intrinsics
CHPL_GMP: gmp
CHPL_HWLOC: hwloc
CHPL_REGEXP: re2
CHPL_WIDE_POINTERS: struct
CHPL_AUX_FILESYS: none
Thanks for reporting this @ty1027. I've got a fix started in PR #7999 that I expect to merge tomorrow at the latest.
Most helpful comment
Thanks for reporting this @ty1027. I've got a fix started in PR #7999 that I expect to merge tomorrow at the latest.