Hi,
the following code
program Foo;
type Bar (U: Cardinal) = array [-1 .. U] of Char;
function Baz (F: Bar): Char; begin Baz := F[-1] end;
begin end.
crashes the compiler:
[~/pascal]% gpc -v Reading specs from /usr/local/lib/gcc-lib/i586-pc-linux-gnu/3.1.1/specs Configured with: ../gcc-3.1.1/configure --enable-languages=pascal Thread model: single gpc version 20021128, based on gcc-3.1.1 [~/pascal]% gpc crash.pas ../../gcc-3.1.1/gcc/p/gpc-typeck.c:1613:build_array_ref: failed assertion `!(TREE_CODE (index) == INTEGER_CST && TYPE_VALUES (TREE_TYPE (array)) && !int_fits_type_p (index, TYPE_VALUES (TREE_TYPE (array))))' crash.pas: In function `Baz': crash.pas:8: Internal compiler error. Please submit a full bug report to the GPC mailing list gpc@gnu.de. See URL:http://www.gnu-pascal.de/todo.html for details.
Exactly the same thing happens also with some other variants of the schema Foo definition:
Bar (U: Cardinal) = array [0 .. U] of Char; Bar (L: Integer; U: Cardinal) = array [L .. U] of Char;
GPC with 2.95.2 backend crashes hs well, in a slightly different place:
[~/pascal]% gpc2 -v Reading specs from /usr/local/bin/../lib/gcc-lib/i586-pc-linux-gnu/2.95.2/specs gpc version 20021111, based on gcc-2.95.2 19991024 (release) [~/pascal]% gpc2 crash.pas /home/emil/dist/gpc-src/gcc-2.95.2/gcc/p/gpc-typeck.c:1860:build_array_ref: failed assertion `0' crash.pas: In function `Baz': crash.pas:8: Internal compiler error. Please submit a full bug report to the GPC mailing list gpc@gnu.de. See URL:http://www.gnu-pascal.de/todo.html for details.
Hope this helps.
Emil