C* Version 7.2 Bug Update Report for Apr 1994 For Connection Machine CM-5 Systems FIXED BUGS The following bugs have been fixed in the current release, Version 7.2. For a description of any bug listed here, contact your Applications Engineer or the Customer Support group at Thinking Machines Corporation. TMCaa01662 goto out of with and where statements doesn't work TMCaa03390 fn calls as opds of comma op at stmt level are broken TMCaa04301 Compiler crash WITH block too large number assignments TMCaa04828 compiling initializations of large arrays is very slow TMCaa04975 VU error with parallel I/O on part of parallel struct or array TMCaa05081 combining send with += incorrect when source type is different TMCaa05138 CMFS I/O may fail with -sparc when I/O multiple of 4 bytes TMCaa05148 parallel fread doesn't work properly with sockets TMCaa05161 Bad C* stab (int) type information TMCaa05162 Bad C* debugging line information makes prism step incorrectly TMCaa05178 Compiler crash with -E -g combination TMCaa05179 64-bit send with combining or doesn't work TMCaa05180 Compiler internal error (register allocation) TMCaa05186 write_to_pvar memory usage is excessive TMCaa05193 enumands are listed in reverse order by prism TMCaa05263 CMFS I/O can corrupt data in some cases TMCaa05277 bad stabs can cause stepping out of order in Prism TMCaa05333 any value reduction (parallel cast to scaler) broken TMCaa05344 scalar left-indexing with 64-bit index doesn't work TMCaa05345 shape indicies cannot be 64-bit integers TMCaa05346 scalar max and min operators don't work for 64-bit integers TMCaa05347 % operator can fail for 64-bit parallel lhs and scalar rhs TMCaa05349 64-bit scalar ints are not converted to floats correctly TMCaa05397 'break' exit from a for loop may corrupt parallel stack TMCaa05408 parallel querry (? :) doesn't contextualize properly TMCaa05409 compiler error -sparc with parallel logical or (||) on doubles TMCaa05426 optimizer incorrectly warns of endless loop TMCaa05436 prism steps incorrectly through return statement TMCaa05451 CMFS physical calls can use too much memory TMCaa05598 Left indexing can produce incorrect values. TMCaa05631 cs -g gives linking error TMCaa05659 Left index expressions like,[.]x+[.]x fail at compile. TMCaa05660 Struct of >1 member list initialization produces wrong answers TMCaa05661 Compile problem with WHERE, using STRUCT and SHAPE declaration TMCaa05682 C*7.2 beta EVERYWHERE in a FOR expression incorrect results. OUTSTANDING BUGS The following bugs are outstanding in the current release. TMCaa01910 Slow compilation of large functions TMCaa01913 Scalar function calls in left index combining operations don't work TMCaa01919 va_start not working for some argument types TMCaa01921 Can't use address of a static pvar in a constant expr TMCaa02009 "L" printf() formatting for long double doesn't work TMCaa03543 Declaration of array of constant-extent shapes causes error TMCaa03705 C* and CMF debugging info format requires prism TMCaa03787 "index" cannot be used as a global variable or function TMCaa03866 Using a PN-resident destination in a strcpy causes error TMCaa03896 embedded macros not always expanded correctly TMCaa03900 VU fmod library function is very slow TMCaa03967 alloca() does not work TMCaa04098 certain static char initializers handled inconsistently TMCaa04267 Attempting to overload a 'static' function fails. TMCaa04354 C* CMFS_open allows open of serial filesystem file TMCaa04414 Incorrect parse of hexadecimal constants ending 'e' in expressions TMCaa04437 realloc(3) conforms to Sun documentation, not to ANSI standard TMCaa04736 Preprocessor concatenation may fail to parse TMCaa04868 inconsistent geometries TMCaa04871 many large expressions may cause 'as' error TMCaa05139 compiler fails if structure doesn't have any members TMCaa05337 Incorrect syntax int (*func(int i)) () crashes the compiler TMCaa05444 memmove doesn't work, not in the library TMCaa05453 left-indexed grid communication may be slower than it should TMCaa05455 tolower function is not ANSI compliant TMCaa05658 cannot define global shape in multipe files TMCaa05670 Fread on file containing ints and chars bad data. Each of these bugs is detailed below. ********************************************************* ID: TMCaa01910 Title: Slow compilation of large functions Description: When compiling large functions, the compiler uses huge amounts of memory and takes a long time to compile. Status: Outstanding. ********************************************************* ID: TMCaa01913 Title: Scalar function calls in left index combining operations don't work Description: Using the result of a scalar function call as the left index in a combining operation (like +=, -=, *=, etc.) causes an internal compiler error. e.g. [foo()]a += 1 does not work. Workaround: Assign the result of the function call into a temporary, then use the temporary as the left-index. Status: Outstanding. ********************************************************* ID: TMCaa01919 Title: va_start not working for some argument types Description: In the ANSI () variable-length argument list mechanism, the va_start macro doesn't work properly if its second argument (the last named function argument) is a parallel variable, a scalar structure or union passed by value, or a pointer to a parallel variable. In the first case (parallel variable), the following compile-time complaint is issued: Casts between pointers to parallel variables and other types are not allowed. In the other cases, runtime behavior is incorrect. Workaround: If a previous (named) argument is not one of the broken types, use it as the second argument to va_start, then treat the following arguments as if they were in the unnamed (...) section. For example: void foo(int n, int:current i1, ...) { ap_list ap; va_start(ap, n); /* can't name i1 here due to bug */ i1 = va_arg(i1, int:current); /* Now we've got the same state as if va_start(ap, i1) worked */ ... } Status: Outstanding. ********************************************************* ID: TMCaa01921 Title: Can't use address of a static pvar in a constant expr Description: The address of a static (including file-scope) parallel variable cannot be used in a constant expression, such as a static initializer. e.g. The following is not allowed: int:physical i; int:physical *p = &i; Status: Outstanding. ********************************************************* ID: TMCaa02009 Title: "L" printf() formatting for long double doesn't work Description: The "L" formatting syntax for long double types is not supported by printf(). This is because C* uses the Sun C libraries which do not support all of the ANSI C constructs. Workaround: Print long doubles using the syntax which would be used for doubles. This works because the representations for the types are the same. Status: Outstanding. ********************************************************* ID: TMCaa03543 Title: Declaration of array of constant-extent shapes causes error Description: Declaring an array of shapes with constant extents will cause internal compiler error. (Note that one can declare an array of shapes of unspecified extents, the more typical use of shape arrays, with no problem.) See the one-line program below. Workaround: Assign the extents at runtime, or compile the file with local optimizations off: -Zcs "-local=nocse -local=nocp". Status: Outstanding. ********************************************************* ID: TMCaa03705 Title: C* and CMF debugging info format requires prism Description: The C* compiler can only emit debugging information which works with Prism. It is not possible to use dbx or gdb to debug C* code compiled with -g. Workaround: debug C* codes using Prism for now. Status: Outstanding. ********************************************************* ID: TMCaa03787 Title: "index" cannot be used as a global variable or function Description: The use of "index" as the name of a global variable or function in a C* program may cause the program to fail at run-time. A typical stack trace: etext() at 0x3c7f8 getwd() at 0xf7933fb8 CMTS_RegisterProcess() at 0x21b98 CMTS_Init_with_verbose_flag() at 0x2522c CMTS_Init() at 0x24f00 CMTS_ScalarMain() at 0x25f2c The problem arises because cmld links libraries into a program which expect to use the "index" function provided in libc.a. A user defining this as a global variable or function prevents the correct version from being linked into the program. Workaround: Use a different name. Status: Outstanding. ********************************************************* ID: TMCaa03866 Title: Using a PN-resident destination in a strcpy causes error Description: Attempts to use strcpy with a destination resident on a processing node will result in a compiler internal error. In order to perform such operations users should resort to the write_to_position instrinsic. Workaround: Use write_to_position instead. Status: Outstanding. ********************************************************* ID: TMCaa03896 Title: embedded macros not always expanded correctly Description: Macros that contain invocations of other macros are sometimes not expanded correctly. For example, given the macro definitions: #define CAT(x, y) CAT_AUX(x, y) #define CAT_AUX(x, y) x ## y #define foobar(x) int x We'd expect the following invocations: CAT(foo, bar)(x); CAT(foo, bar)(y); To yield: int x; int y; Instead we can use the -P switch to see thay they yield: int x ; CAT_AUX(foo, bar) (y); Notice that the second CAT_AUX invocation isn't expanded. This happens only under certain (complex) circumstances - normally embedded macros are expanded properly. (In the above case, if the #define of foobar is removed, we get the proper expansion.) Workaround: Directly invoking the embedded macro that's not being expanded fixes the problem. In this example, inserting a harmless invocation of CAT_AUX(,) after each invocation of CAT fixes the problem. Status: Outstanding. ********************************************************* ID: TMCaa03900 Title: VU fmod library function is very slow Description: The current implementation of the VU fmod function is iterative, and potentially synchronizes the vector unit pipelines several times for each vector of user data. As a result it executes quite slowly, in comparison to other math library routines. Status: Outstanding. ********************************************************* ID: TMCaa03967 Title: alloca() does not work Description: Calls to the C alloca() function fail at runtime. This function must be processed specially on the SPARC, and the C* compiler does not perform this special processing. Workaround: Use malloc() instead, but remember to use free() to reclaim the memory. Status: Outstanding. ********************************************************* ID: TMCaa04098 Title: certain static char initializers handled inconsistently Description: When a static (including file-scope) character initializer is greater than 127 (the maximum signed char - note that chars are signed by default), a zero value is used. While this is not technically a bug (ANSI considers this an overflow), it is inconsistent with the way other unsigned quantities are converted to signed, and counter to the assumptions of many C programmers. Workaround: Use the appropriate negative value instead. For example, change: char c = 255; to: char c = -1; The "appropriate negative value" is -(256-val). Status: Outstanding. ********************************************************* ID: TMCaa04267 Title: Attempting to overload a 'static' function fails. Description: Function definitions with file scope may not be overloaded. Attempts to do so result in an error message of the form *** ERROR: on line 123 in foo.cs Declaration linkage does not match linkage of previous declaration. Workaround: Do not declare the funtion(s) 'static'. Alternatively, use different names for each overloading. Status: Outstanding. ********************************************************* ID: TMCaa04354 Title: C* CMFS_open allows open of serial filesystem file Description: The C* CMFS IO interface supports only filesystems on parallel devices such as Datavaults and Scalable Disk Arrays. However, the CMFS_open call does not check to insure that it is opening a file on a parallel device, nor do CMFS read and write calls check that the device is parallel. Thus erroneous operations may be performed on a serial filesystem file without an appropriate warning or error message being returned to the user. Status: Outstanding. ********************************************************* ID: TMCaa04414 Title: Incorrect parse of hexadecimal constants ending 'e' in expressions Description: Using a hexadecimal constant ending in 'e' within an arithmetic expression may cause the parse to incorrectly reject the expression. For example, the program "main(){int i=0xe+1;}" will not parse correctly. Workaround: Insert spaces into the expression, change to 0xe + 1, or remove the hex constant from the expression, or wrap it with parentheses. Status: Outstanding. ********************************************************* ID: TMCaa04437 Title: realloc(3) conforms to Sun documentation, not to ANSI standard Description: The behaviour of the realloc(3) function conforms to the SunOS documentation, and not the ANSI standard for the C language. This can be worked around, for example, by using a macro to wrap realloc and provide the desired behaviour. Workaround: Wrap realloc in a MACRO to provide correct behaviour Status: Outstanding. ********************************************************* ID: TMCaa04736 Title: Preprocessor concatenation may fail to parse Description: When lexical tokens of distinct token class are concatenated using the ## preprocessor syntax, the resulting expression is not properly parsed, and an error is erroneously reported. Workaround: Use gcc -E with appropriate include directives for your installation of C*. Status: Outstanding. ********************************************************* ID: TMCaa04868 Title: inconsistent geometries Description: Geometry layouts that "ought" to be the same are not, for CM-5's of certain sizes. In the following cases, (1) and (2) ought to be identical, but aren't, and (3) ought to be similar to (2), but isn't. (1) created by a declaration, e.g. shape [n] [m] sh_p; (2) created by a call to allocate_detailed_shape specifying only extents and orderings, e.g. unsigned long ext [2] = {n, m}; CMC_axis_order_t ord [2] = {CMC_news_order, CMC_news_order}; shape sh_q = allocate_detailed_shape (&sh_q, 2, ext, NULL, ord, NULL, NULL, NULL); (3) created as in (2), but with an extra serial axis, e.g. unsigned long ext [3] = {k, n, m}; CMC_axis_order_t ord [3] = {CMC_serial_order, CMC_news_order, CMC_news_order}; shape sh_r = allocate_detailed_shape (&sh_r, 3, ext, NULL, ord, NULL, NULL, NULL); Workaround: Use a different-sized CM (a square one?) OR, pass in an array of all 1's for the weights. I tried this, and it worked, and it is consistent with what appears to be the cause of the problem. Status: Outstanding. ********************************************************* ID: TMCaa04871 Title: many large expressions may cause 'as' error Description: When the -vu target is in effect, and a very large elemental code block is present, using many subexpressions repeatedly (thus requiring a large amount of VU memory be allocated for spilling register overflow), then invalid sparc assembly instructions may be issued. Workaround: Break up the problem codeblock, as for example with a dummy subroutine call or a branch not taken. Status: Outstanding. ********************************************************* ID: TMCaa05139 Title: compiler fails if structure doesn't have any members Description: Declaring a structure that doesn't have any members can cause an internal compiler error when compiling with -g. Workaround: insert a dummy member into the structure Status: Outstanding. ********************************************************* ID: TMCaa05337 Title: Incorrect syntax int (*func(int i)) () crashes the compiler Description: Incorrect syntax of the following form int (*func(int i)) () crashes the compiler. Status: Outstanding. ********************************************************* ID: TMCaa05444 Title: memmove doesn't work, not in the library Description: The memmove function, which is part of the ANSI C standard, does not work in C*. Attempts to use it will cause the function to be unresolved when linking. Workaround: Use memcpy instead, but beware of the slightly different semantics. Status: Outstanding. ********************************************************* ID: TMCaa05453 Title: left-indexed grid communication may be slower than it should Description: Grid communication expressed with left-indexed syntax may be too slow. In some cases the compiler is generating send or get operations instead of grid communication operations. The code runs correctly; only performance is affected. Workaround: Use the functions instead of the left-indexed syntax. Status: Outstanding. ********************************************************* ID: TMCaa05455 Title: tolower function is not ANSI compliant Description: The tolower function in C* does not behave as ANSI C says it should. This is because the C* compiler just uses the Sun tolower function in libc.a. This version is only well-defined for characters that are upper case. Workaround: Write instead: *s = isupper(*s) ? tolower(*s) : *s; Status: Outstanding. ********************************************************* ID: TMCaa05658 Title: cannot define global shape in multipe files Description: If a global shape is defined in more than one file, compiler will generate multiple define errors: /usr/tmp/cm5csAAAa03478glen2.o: _CMC__vec_init_flag: multiply defined ld: /usr/tmp/cm5csAAAa03478glen2.o: _CMC__alloc_vec_pointer: multiply defined ld: /usr/tmp/cm5csAAAa03478glen2.o: _CMC__alloc_vec: multiply defined Workaround: define the global shape as extern in the ".h", and define the shape in one of the cs file. Status: Outstanding. ********************************************************* ID: TMCaa05670 Title: Fread on file containing ints and chars bad data. Description: Parallel fread on files containing a comination of ints and chars into CM arrays produce a corrupted array. To woraround have 2 files one for the ints, scalar data and one for the CM data. Workaround: avoid using combinations of variables in files with fread. or read the file locally Status: Outstanding.