Chapel: Conversion of an empty string to real(64) results in segmentation fault

Created on 9 Dec 2017  路  1Comment  路  Source: chapel-lang/chapel

Summary of Problem

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

Steps to Reproduce

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

Configuration Information

  • 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

Libraries / Modules Runtime Bug user issue

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.

>All comments

Thanks for reporting this @ty1027. I've got a fix started in PR #7999 that I expect to merge tomorrow at the latest.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

ben-albrecht picture ben-albrecht  路  3Comments

lydia-duncan picture lydia-duncan  路  3Comments

buddha314 picture buddha314  路  3Comments

BryantLam picture BryantLam  路  3Comments

vasslitvinov picture vasslitvinov  路  3Comments