Two days ago I started work on a port for the FreeBSD 4.0-current ports collection.
Ok, I just managed to compile gpc beta by patching it similiar to how the existing gcc 2.8.1 port for FreeBSD does, plus one additional change:
marc@oranje$ gpc -v Reading specs from /usr/ports/lang/gcc28/work/local/lib/gcc-lib/i386-unknown-freebsd4.0/2.8.1/specs gpc version 19990118, based on gcc-2.8.1 marc@oranje$
My first test example worked:
marc@oranje$ gpc -Wall -o u2a1 u2a1.pas marc@oranje$ ./u2a1 Wert für feld[1]? 10 Wert für feld[2]? 20 Wert für feld[3]? 25 Wert für feld[4]? 33 Wert für feld[5]? 0 Das Maximum ist: 33 marc@oranje$
The second however did not:
marc@oranje$ gpc -Wall -o u3a4 u3a4.pas u3a4.pas: In function `Listeeinlesen': u3a4.pas:144: warning: missing string capacity - assuming 255 marc@oranje$ ./u3a4 Bitte geben Sie die zu sortierenden Zahlen ein. Beenden Sie Ihre Eingabe mit einer Leerzeile. 10 4 5 29 0
Segmentation fault (core dumped) marc@oranje$
Nice to see you support familiar gcc options (I have no clue yet about gpc):
marc@oranje$ gpc -Wall -pedantic -o u3a4 u3a4.pas u3a4.pas: In function `Listeeinlesen': u3a4.pas:144: warning: missing string capacity - assuming 255 u3a4.pas:151: warning: ISO Pascal does not allow reading of strings from textfiles u3a4.pas:152: warning: ISO Pascal does not define `Val' u3a4.pas:156: warning: ISO Pascal does not allow reading of strings from textfiles u3a4.pas:157: warning: ISO Pascal does not define `Val' u3a4.pas: At top level: u3a4.pas:180: warning: third argument of `main' is deprecated
Strange Warning, does C shine through somehow?
Testing if gdb works:
marc@oranje$ gpc -g -o u3a4 u3a4.pas u3a4.pas: In function `Listeeinlesen': u3a4.pas:144: warning: missing string capacity - assuming 255 marc@oranje$ gdb u3a4 GNU gdb 4.18 Copyright 1998 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-unknown-freebsd"... (gdb) l 171 begin 172 writeln (Zeiger^.info); 173 Zeiger := Zeiger^.next; 174 end; { while } 175 end; { GibListeAus } 176 begin 177 ListeEinlesen (RefListe); 178 SortiereListe (RefListe); 179 GibListeAus (RefListe) 180 end. { TesteSortiereListe } (gdb) r Starting program: /home/marc/research/hagen/kip/u3a4 Bitte geben Sie die zu sortierenden Zahlen ein. Beenden Sie Ihre Eingabe mit einer Leerzeile. 2 4 5
Program received signal SIGSEGV, Segmentation fault. 0x80545fd in Strlen (Src=0x416) at gstrings.pas:309 309 while Temp^ <> #0 do Inc (Temp); (gdb) p Temp^ (gdb) p Temp^ Undefined command: "". Try "help". (gdb) p Temp $1 = (Char *) 0x416 (gdb) bt #0 0x80545fd in Strlen (Src=0x416) at gstrings.pas:309 #1 0x8050208 in _p_get_file_name (File=0xbfbfd564) at file.c:1334 #2 0x804f0fa in _p_ok_EOF (File=0xbfbfd564) at file.c:754 #3 0x804a7a8 in _p_direct_getc_checkeof (File=0xbfbfd564) at read.c:80 #4 0x804a84a in _p_readi_check (File=0xbfbfd564, check=NoRangeCheck, min=0, max=0) at read.c:128 #5 0x804b0cf in _p_readi (File=0xbfbfd564) at read.c:237 #6 0x804d1e6 in _p_val_integer_nocheck (string=0xbfbfd9ec "5", maxchars=0, flags=0, var=0xbfbfd9e0) at read.c:697 #7 0x8049437 in Listeeinlesen (Outliste=@0x80647a4) at u3a4.pas:157 #8 0x80494ad in program_Testesortiereliste () at u3a4.pas:177 #9 0x8049518 in main (argc=1, argv=0xbfbfdb30, envp=0xbfbfdb38) at u3a4.pas:180 (gdb) quit The program is running. Exit anyway? (y or n) y marc@oranje$
Not bad. This will give some fun. :)
Yes. I am currently finishing up some tests under a bigendian machine (Sun/Solaris) and will announce a new Alpha release Real Soon Now[tm].
No hurry.
An experimental port (= the BSD package system) is working.
I have just barely enough time in October to research how to make it a nice one, integrating it correctly into the FreeBSD framework. When this issue is solved I go for bug hunting and will gladly help to smoothen things next month.
Regards, Marc