On 3/7/2015 10:59 AM, Eric Robertson wrote: <snip>
In any case, the abort message from the OpenVMS C compiler was as follows: CC/name=(as_i,shor)/repo=lcl_root:[bash.cxx_repository]/debu/list/mach/show=(EXPA,INC)/prefix=(all,exce=(strtoimax,strtoumax))/neste d=none/define=(_USE_STD_STAT=1,_POSIX_EXIT=1,HAVE_CONFIG_H=1)/OBJ=VARIABLES.OBJ LCL_ROOT:VARIABLES.C ind = array_expand_index (name, subp, sublen); ..................................................^ %CC-W-PTRMISMATCH, In this statement, the referenced type of the pointer value "name" is "const char", which is not compatible with "struct variable". at line number 2576 in file LCL_ROOT:[bash]VARIABLES.C;1 %MMK-F-ERRUPD, error status %X10B91260 occurred when updating target VARIABLES.OBJ Such warnings about type disagreements are always suspicious when non-void (or non-void *) types are involved and, as it turns out, this source code statement is indeed completely illogical as the called function (array_expand_index in this particular case) has no logical provision within its implementation for dealing with a const char * as its first argument. From the context of the preceding source code, it was apparent that the name of the first argument to this function should be changed from "name" to "entry" in order for the statement to be both logically correct and type compatible with the function being called. Of course, it is completely possible for the compiler to generate the machine instructions to carry out the call as originally written. But, the execution of those generated instructions would have at the very least produce undefined behavior and at worst a core dump. The diff for the correction against the variables.c module for bash-4.3.33 follows: ROBERTSON@srvr1:/src_root/bash > diff -uN variables.c.orig variables.c --- variables.c.orig Sat Mar 7 10:19:39 2015 +++ variables.c Sat Mar 7 09:34:04 2015 @@ -2573,7 +2573,7 @@ entry = make_new_array_variable (newname); /* indexed array by default */ if (entry == 0) return entry; - ind = array_expand_index (name, subp, sublen); + ind = array_expand_index (entry, subp, sublen); bind_array_element (entry, ind, value, aflags); } #endif
Any resolution for this issue? In arrayfunc.h: extern arrayind_t array_expand_index __P((SHELL_VAR *, char *, int)); SHELL_VAR is a struct declared in variables.h. So passing it const char * should be causing problems. Regards, -John