David Wood wrote:
It appears that gpc20050217 doesn't like the use of a constant index in an array assignment within a procedure. It's fine when the same assignment is done with a constant index in the main program.
The problem was due to negative array bounds. The following should fix the problem:
--- types.c.bb 2005-02-25 01:54:37.527931256 +0100 +++ types.c 2005-02-25 02:59:38.576881672 +0100 @@ -2571,11 +2571,11 @@ this can be disabled partially. */ if (TYPE_DOMAIN (TREE_TYPE (array))) { - tree s_ind = convert (sizetype, index); - tree s_min = convert (sizetype, TYPE_MIN_VALUE ( + tree s_ind = convert (ssizetype, index); + tree s_min = convert (ssizetype, TYPE_MIN_VALUE ( TYPE_DOMAIN (TREE_TYPE (array)))); res = build_indirect_ref (build_pascal_binary_op (PLUS_EXPR, ar, - fold (build (MINUS_EXPR, sizetype, s_ind, s_min))), NULL); + fold (build (MINUS_EXPR, ssizetype, s_ind, s_min))), NULL); } else res = build_indirect_ref (build_pascal_binary_op (PLUS_EXPR, ar, index), NULL);