Greetings,
I think I might have discovered a bug in gpc. A test program follows.
John Ollason
-------------------
{ The following program illustrates a bug discovered in gpc. The program functions correctly with the set 0..31, but with the set 0..32 or greater the second call to card returns zero, and the contents of the set disappear after the first call.
The following is the output from gpc --verbose
Using builtin specs. gpc version 19990118, based on gcc-2.8.1 ld -m elf_i386 -dynamic-linker /lib/ld-linux.so.2 /usr/lib/crt1.o /usr/lib/crti.o /usr/lib/gcc-lib/i386-redhat-linux/2.8.1/crtbegin.o -L/usr/lib/gcc-lib/i386-redhat-linux/2.8.1 -L/usr/i386-redhat-linux/lib -lgpc -lm -lgcc -lc -lgcc /usr/lib/gcc-lib/i386-redhat-linux/2.8.1/crtend.o /usr/lib/crtn.o /usr/lib/crt1.o(.text+0x18): undefined reference to `main' }
program settest(input,output); var i:integer; a: array[1..1] of record stuff:set of 0..32; end; begin with a[1] do begin stuff:=[]; stuff:=stuff+[2]; stuff:=stuff+[3]; writeln(card(stuff)); for i in stuff do writeln(i); writeln(card(stuff)); for i in stuff do writeln(i); end end.
John Ollason wrote:
{ The following program illustrates a bug discovered in gpc. The program functions correctly with the set 0..31, but with the set 0..32 or greater the second call to card returns zero, and the contents of the set disappear after the first call.
The following is the output from gpc --verbose
Using builtin specs. gpc version 19990118, based on gcc-2.8.1
This problem does not occur with my current GPC based on gcc-2.95.1 on i586-pc-linux-gnu. I recommend you to upgrade your GPC and to check whether the problem still exists.
Hope this helps,
Peter
Peter,
I downloaded and installed the binary gpc-20000727.i686-pc-linux-gnu.tar.gz, and the bug I reported is gone. I am very impressed with how much faster the new compiler is than the old one.
Thank you once again for the speed of your response.
John Ollason