I wrote the following code:
PROCEDURE play( map : map_type ); VAR
player1 : player_type( 'O', 'a', 'd', 'w', 's', red, right, 10, 10, 3 ); player2 : player_type( 'O', Crt.ksLeft, Crt.ksRight, Crt.ksUp, Crt.ksDown, green, left, 15, 15, 3 ); table : table_type_ptr;
BEGIN
new( table, map.width, map.height );
...
END;
END;
And here are the important types:
x_coordinate_type = 1..table_width; x_dimension_type = 1..table_width;
map_type( w, h, p1x, p1y, p2x, p2y : INTEGER ) = RECORD
width : x_dimension_type VALUE w; height : y_dimension_type VALUE h; player1_pos : player_pos_type VALUE [ p1x; p1y ]; player2_pos : player_pos_type VALUE [ p2x; p2y ]; collision : BOOLEAN VALUE FALSE; data : ARRAY[ 1..h, 1..w ] OF CHAR;
END;
table_type( w, h : INTEGER ) = ARRAY[ 1..h, 1..w ] OF field_type; table_type_ptr = ^table_type;
When I want to compile the code I get the following error:
snake.pas: In procedure `play': snake.pas:203: internal compiler error: in process_otherwise, at p/typecheck.c:4407 Please submit a full bug report, with preprocessed source if appropriate. See URL:http://www.gnu-pascal.de/todo.html for instructions. For Debian GNU/Linux specific bug reporting instructions, see URL:file:///usr/share/doc/gcc-4.1/README.Bugs.
The problem is the call to new. Is this my fault?
Martin Kalbfuà wrote:
I wrote the following code:
PROCEDURE play( map : map_type ); VAR
player1 : player_type( 'O', 'a', 'd', 'w', 's', red, right, 10, 10, 3 ); player2 : player_type( 'O', Crt.ksLeft, Crt.ksRight, Crt.ksUp, Crt.ksDown, green, left, 15, 15, 3 ); table : table_type_ptr;
BEGIN
new( table, map.width, map.height );
...
END;
END;
And here are the important types:
x_coordinate_type = 1..table_width; x_dimension_type = 1..table_width;
map_type( w, h, p1x, p1y, p2x, p2y : INTEGER ) = RECORD
width : x_dimension_type VALUE w; height : y_dimension_type VALUE h; player1_pos : player_pos_type VALUE [ p1x; p1y ]; player2_pos : player_pos_type VALUE [ p2x; p2y ]; collision : BOOLEAN VALUE FALSE; data : ARRAY[ 1..h, 1..w ] OF CHAR;
END;
table_type( w, h : INTEGER ) = ARRAY[ 1..h, 1..w ] OF field_type; table_type_ptr = ^table_type;
When I want to compile the code I get the following error:
snake.pas: In procedure `play': snake.pas:203: internal compiler error: in process_otherwise, at p/typecheck.c:4407 Please submit a full bug report, with preprocessed source if appropriate. See URL:http://www.gnu-pascal.de/todo.html for instructions. For Debian GNU/Linux specific bug reporting instructions, see URL:file:///usr/share/doc/gcc-4.1/README.Bugs.
When reporting compiler problems, please always try to send a complete program rather than fragments (i.e., from "program" to "end." without any "..." -- it doesn't have to be your original program, it can be fragments, but completed, so it should compile, if it weren't for the compiler error -- and then, of course, check that the compiler error actually occurs with the program you send). This makes it easier for everyone to check the problem and possible fixes, and you can make sure you don't forget some declarations (such as player_pos_type etc.).
Also please specify the compiler version (do "gpc -v") and operating system (which seems to be Debian GNU/Linux according to the error message).
Frank