[Sent this report to Peter in private, but he may be busy with the German LinuxTag?]
Currently gpc does not bootstrap with gcc-2.95.2 on Linux (glibc-2.1.94) on architectures other than i386 and m68k. This report is from the alpha arch.
../.././xgcc -B/usr/alpha-linux/bin/ -B../.././ -I/usr/alpha-linux/include -c -I. -W -Wall -Wpointer-arith -Wwrite-strings -Wmissing-prototypes -Wmissing-declarations -g -O2 -DRTS_RELEASE_STRING="'`cat /src/gcc/2.95.2-16/gcc-2.95.2/src-native/gcc/p/rts/rts-version`'" -Wno-unused -Wno-missing-declarations -Wno-missing-prototypes /src/gcc/2.95.2-16/gcc-2.95.2/src-native/gcc/p/rts/rts-va.c /src/gcc/2.95.2-16/gcc-2.95.2/src-native/gcc/p/rts/rts-va.c:51: macro `va_start' used with just one arg /src/gcc/2.95.2-16/gcc-2.95.2/src-native/gcc/p/rts/rts-va.c:247: macro `va_start' used with just one arg /src/gcc/2.95.2-16/gcc-2.95.2/src-native/gcc/p/rts/rts-va.c:289: macro `va_start' used with just one arg /src/gcc/2.95.2-16/gcc-2.95.2/src-native/gcc/p/rts/rts-va.c:434: macro `va_start' used with just one arg /src/gcc/2.95.2-16/gcc-2.95.2/src-native/gcc/p/rts/rts-va.c:482: macro `va_start' used with just one arg make[5]: *** [rts-va.o] Error 1 make[5]: Leaving directory `/src/gcc/2.95.2-16/gcc-2.95.2/build-native/gcc/p/rts' make[4]: *** [pascal.rts] Error 2 make[4]: Leaving directory `/src/gcc/2.95.2-16/gcc-2.95.2/build-native/gcc' make[3]: *** [boot_stage_c] Error 2 make[3]: Leaving directory `/src/gcc/2.95.2-16/gcc-2.95.2/build-native/gcc' make[2]: *** [bootstrap-lean] Error 2 make[2]: Leaving directory `/src/gcc/2.95.2-16/gcc-2.95.2/build-native' s=`cat status`; rm -f status; test $s -eq 0 make[1]: *** [stamps/05-build-stamp-native] Error 1 make[1]: Leaving directory `/src/gcc/2.95.2-16/gcc-2.95.2' make: *** [stamps/05-build-stamp-native] Error 2
Stuart Pope wrote:
--- Frank Heckenbach frank@g-n-u.de wrote:
Stuart Pope wrote:
I am puzzled. I am using gpc on a unix system (Irix 6.5). When the
compiler was built, we had to turn off the -g flag everywhere in the Makefiles(which, we
understand, is a common problem) in
order to complete the build. Below is a small program which simply writes out a real number
using
'writeln'. It compiles fine, but generates garbage output:
That's a known bug on IRIX (listed on the To-Do list, http://agnes.dida.physik.uni-essen.de/~gnu-pascal/todo.html).
(Peter, this will be fixed by getting rid of the varargs stuff in the RTS.)
For now, there's a work-around (in recent GPC versions). Please look for `LongReal2Str' in the `GPC' unit.
Thank you for your response to my question regarding writing of real numbers under IRIX. I tried your fix, but I get the message 'module Gpc could not be imported' in connection with the 'use' statement you've included in your fix.
(* Please use the option `--automake' when you use any units. *)
Any further suggestions? Also, is this due to be fixed soon for IRIX systems? It seems like such an obvious bug...I'm surprised it hasn't been dealt with already. Thanks for your help..really!
The problem is that this seems to be a bug in the C compiler WRT variadic functions (which are used to implement `Writeln' etc. internally). Consider the following test program which does not work correctly on an IRIX system I have access to...
#include <varargs.h>
void foo (va_alist) va_dcl { va_list p; int i; double q; va_start (p); i = va_arg (p, int); q = va_arg (p, double); printf ("%i %i\n", i, (int) q); }
int main () { double q = 8.0; foo (42, q); return 0; }
We plan to get rid of the variadic functions, but that's not trivial to do. (But read on...)
Matthias Klose wrote:
Currently gpc does not bootstrap with gcc-2.95.2 on Linux (glibc-2.1.94) on architectures other than i386 and m68k. This report is from the alpha arch.
../.././xgcc -B/usr/alpha-linux/bin/ -B../.././ -I/usr/alpha-linux/include -c -I. -W -Wall -Wpointer-arith -Wwrite-strings -Wmissing-prototypes -Wmissing-declarations -g -O2 -DRTS_RELEASE_STRING="'`cat /src/gcc/2.95.2-16/gcc-2.95.2/src-native/gcc/p/rts/rts-version`'" -Wno-unused -Wno-missing-declarations -Wno-missing-prototypes /src/gcc/2.95.2-16/gcc-2.95.2/src-native/gcc/p/rts/rts-va.c /src/gcc/2.95.2-16/gcc-2.95.2/src-native/gcc/p/rts/rts-va.c:51: macro `va_start' used with just one arg [...]
Well, I don't know too much about variadic functions (and don't like them much, either ;-), but according to my knowledge, this looks like a bug in the system headers. There are two variants of varargs, pre-ISO (varargs.h) and ISO (stdarg.h). In the former, va_start has one argument, in the latter two arguments. rts-va.c includes varargs.h and uses one parameter, so it should be ok.
Anyway, if we switch to ISO varargs, it might work on these architectures. However, the glibc 2.1.3 manual (Node: Old Varargs) says: "The GNU C compiler still supports [pre-ISO varargs]; currently, it is more portable than the ISO C facility, since support for ISO C is still not universal." But since the RTS will always be compiled with GCC, anyway, I think we can ignore this problem...
In light of this issue, I tried the test program with ISO varargs under IRIX, and it seems to work. I'm somewhat surprised, but it means that there's hope.
Stuart and Matthias, you might want to test both C programs and check that the change makes a difference. If it does, I can rather easily change the RTS to ISO varargs...
(And it would mean that the statement "The GNU C compiler still supports [pre-ISO varargs]" is not quite correct anymore -- if anyone feels like reporting this to the glibc manual authors...)
#include <stdarg.h>
void foo (int i, ...) { va_list p; double q; va_start (p, i); q = va_arg (p, double); printf ("%i %i\n", i, (int) q); }
int main () { double q = 8.0; foo (42, q); return 0; }
Frank
Hi,
to fix a problem with writing reals on IRIX, and another problem building the RTS on Linux/Alpha (any maybe other processors except x86 and m68k), I've changed the RTS to ISO varargs.
Matthias and Stuart (who reported these bugs), please let me know if it still doesn't work. If anyone else encounters problems in rts/rts-va.c now, also let me know.
If it works, I'll remove the `LongReal2Str' work-around for IRIX soon.
Frank