Hello, Is it possible to make the set datatype to occupy only one byte? Now by default the compiler allocates 4 bytes.We even tried packing it,but it's still the same.
After reading this message, I tried to experiment with set types a little bit. It turned out that the compiler segfaults on "set of Void" (this is a nonsense type, but anyway...)
[pas]% gpc -v ; uname -a Reading specs from /usr/local/lib/gcc-lib/i586-pc-linux-gnu/2.95.2/specs gpc version 20020308, based on 2.95.2 19991024 (release) Linux localhost.localdomain 2.4.2-2 #1 Sun Apr 8 19:37:14 EDT 2001 i586 unknown [pas]% cat voidset.pas program VoidSet (Output);
type T = set of Void; (* WRONG *)
begin WriteLn ('failed') end. [pas]% gpc voidset.pas voidset.pas:4: ordinal type expected gpc: Internal compiler error: program gpc1 got fatal signal 11 (Segmentation fault) [pas]% gdb /usr/local/lib/gcc-lib/i586-pc-linux-gnu/2.95.2/gpc1 core GNU gdb 5.0rh-5 Red Hat Linux 7.1 Copyright 2001 Free Software Foundation, Inc. GDB is free software, covered by the GNU General Public License, and you are welcome to change it and/or distribute copies of it under certain conditions. Type "show copying" to see the conditions. There is absolutely no warranty for GDB. Type "show warranty" for details. This GDB was configured as "i386-redhat-linux"... Core was generated by `/usr/local/lib/gcc-lib/i586-pc-linux-gnu/2.95.2/gpc1 /tmp/ccSEiSIV.i -quiet -du'. Program terminated with signal 11, Segmentation fault. Reading symbols from /lib/libc.so.6...done. Loaded symbols for /lib/libc.so.6 Reading symbols from /lib/ld-linux.so.2...done. Loaded symbols for /lib/ld-linux.so.2 #0 0x0816d399 in layout_type (type=0x8274028) at ../../../gcc-2.95.2/gcc/p/../stor-layout.c:1053 1053 ../../../gcc-2.95.2/gcc/p/../stor-layout.c: No such file or directory. in ../../../gcc-2.95.2/gcc/p/../stor-layout.c (gdb) bt #0 0x0816d399 in layout_type (type=0x8274028) at ../../../gcc-2.95.2/gcc/p/../stor-layout.c:1053 #1 0x081b2159 in build_set_type (members=0x8274014) at ../../../gcc-2.95.2/gcc/p/types.c:579 #2 0x081a358f in yyparse () at parse.y:2043 #3 0x0816fae1 in compile_file (name=0xbffffb84 "/tmp/ccSEiSIV.i") at ../../../gcc-2.95.2/gcc/p/../toplev.c:3265 #4 0x08172dca in main (argc=8, argv=0xbffffa1c) at ../../../gcc-2.95.2/gcc/p/../toplev.c:5440 #5 0x40041e5e in __libc_start_main (main=0x8171e14 <main>, argc=8, ubp_av=0xbffffa1c, init=0x80490f8 <_init>, fini=0x81ba7a0 <_fini>, rtld_fini=0x4000d3c4 <_dl_fini>, stack_end=0xbffffa0c) at ../sysdeps/generic/libc-start.c:129
GPC accepts "array of Void" (and even static variables of that type; should it?), but it crashes on "packed array of Void". More importantly, it crashes the same way on the following ISO 7185 code:
[pas]% cat recordend1.pas program Foo (Output);
type T = packed array [1 .. 42] of record end;
begin WriteLn ('OK') end. [pas]% gpc recordend1.pas recordend1.pas:4: Internal compiler error in `float_signal', at toplev.c:2418 Please submit a full bug report. See URL:http://www.gnu.org/software/gcc/faq.html#bugreport for instructions.
A similar file-type generates a run-time error:
[pas]% cat recordend2.pas program Foo (Output);
type EmptyType = record end;
var F: file of EmptyType;
begin rewrite (F); { F^ := EmptyType[]; } put (F); reset (F); get (F); writeln ('OK') end. [pas]% gpc recordend2.pas [pas]% ./a.out ./a.out: internal error: `InitFDR' has not been called for file (error #913 at 8049c05)
Emil Jerabek