Following on from my earlier runtime arithmetical error report, see attached code.
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.
I'm running gpc20050217 (patched with gpc.diff-uc) under gcc.3.4.2 in FC3 Linux on a P4 processor.
Regards
David.
The Information contained in this E-Mail and any subsequent correspondence is private and is intended solely for the intended recipient(s). For those other than the recipient any disclosure, copying, distribution, or any action taken or omitted to be taken in reliance on such information is prohibited and may be unlawful.
Emails and other electronic communication with QinetiQ may be monitored. Calls to QinetiQ may be recorded for quality control, regulatory and monitoring purposes.
Wood David wrote:
[...]
Well, thanks for trying to help locate GPC bugs, but again, with an email boilerplate like this, we cannot do much with it, nor include your test cases into the test suite etc.
If your company doesn't really want to restrict such bug reports, and if you have no way to disable this boilerplate, I suggest you get an account on any of the various free email providers and use this for posting here. (You'll have to change your list subscription address then in order for your posts to get through, of course.)
Alternatively, you can use the upload form on the web site. (But then only I'll get it, though I might pass it on to the list if I'm allowed.)
Frank
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);