GPC BUG: Enum variable cannot be used in set iteration for loop
Hello, I found the following bug in the Beta version of GPC. Best regards, Peter Dietrich -------------------- GPC-Version (gpc -v): Reading specs from C:\usr\local\lib\gcc-lib\i386-mingw32\2.8.1\specs gpc version 19990118, based on gcc-2.8.1 System-Version: Windows NT 4.0 on i386 Problem description: A variable of enum type cannot be used in a "for var in" statement. The following program results in compiler error message: test2.pas: In function `program_Test': test2.pas:7: incompatible types in assignment program test (output); type t = (red,green,blue); var e : t; begin for e in [red,green] do writeln (integer(e)); end.
Hallo, Peter!
A variable of enum type cannot be used in a "for var in" statement.
Fixed (pd1.pas). Thanks for the report. Patch below or in the next snapshot. Peter -- Peter Gerwinski, Essen, Germany, http://home.pages.de/~Peter.Gerwinski/ Maintainer GNU Pascal - http://home.pages.de/~GNU-Pascal/ - gpc-19990118 PGP key on request - 6C 94 45 BE 28 A4 96 - 0E CC E9 12 47 25 82 75 *** Vote against SPAM! ********* http://www.politik-digital.de/spam/ *** --- parse.y.orig Sun Jun 13 10:56:02 1999 +++ parse.y Thu Jun 17 00:28:11 1999 @@ -4744,8 +4744,8 @@ set_domain = TYPE_DOMAIN (TREE_TYPE ($4)); else set_domain = TREE_TYPE ($4); - for_l_bound = TYPE_MIN_VALUE (set_domain); - for_u_bound = TYPE_MAX_VALUE (set_domain); + for_l_bound = convert (TREE_TYPE (TREE_TYPE ($4)), TYPE_MIN_VALUE (set_domain)); + for_u_bound = convert (TREE_TYPE (TREE_TYPE ($4)), TYPE_MAX_VALUE (set_domain)); $<ttype>$ = for_u_bound; set_var = make_new_variable ("for_set", TREE_TYPE ($4)); expand_expr_stmt (build_modify_expr (set_var,
participants (2)
-
pdietrich@synstar.de -
Peter Gerwinski