Hi Frank,
thanks for your quick reply - and sorry for being late at my end, I got distracted by non-computer things.
On Fri, May 19, 2006 at 03:45:06PM +0200, Frank Heckenbach wrote:
I just tried it on AIX 5.3, with gcc-3.4.6, and the result is sort of "mixed":
There is one line that needs to be changed in gcc/p/test/test_run, because otherwise I'll get an error from the shell (in make check):
old:
echo "$PC `$PC $PFLAGS -dumpversion`, flags: $PFLAGS_NO_PATHS `if [ echo "$PC `$PC $PFLAGS -dumpversion`, flags: $PFLAGS_NO_PATHS `if [ x"$GP" != x ]; then echo "(using GP)"; fi`"
new:
echo "$PC `$PC $PFLAGS -dumpversion`, flags: $PFLAGS_NO_PATHS `if [ echo "$PC `$PC $PFLAGS -dumpversion`, flags: $PFLAGS_NO_PATHS `if [ x"$GP" != x ]; then echo "(using GP)"; fi`"
What's that? The original line is:
echo "$PC `$PC $PFLAGS -dumpversion`, flags: $PFLAGS_NO_PATHS `if [ x"$GP" != x ]; then echo "(using GP)"; fi`"
Perhaps you unintentionally duplicated a part of it (from the beginning to the first "[")?
Yes. I'm not sure how that happened, but that's what you get when using the mouse for "insert lines of code into mail".
The (changed) line indeed looks like this:
echo "$PC `$PC $PFLAGS -dumpversion`, flags: $PFLAGS_NO_PATHS `if [ x"$GP" != x ]; then echo "(using GP)"; fi`"
So I assume it should be changed to:
echo "$PC `$PC $PFLAGS -dumpversion`, flags: $PFLAGS_NO_PATHS `if [ x"$GP" != x ]; then echo "(using GP)"; fi`"
Yes.
(the change is that "(using GP)" needs extra quotes, otherwise the shell will complain - this is with AIX' ksh, but as far as I know, recent bash versions will be similarily picky)
Not AFAICS:
# bash --version GNU bash, version 3.1.0(1)-release (i686-pc-linux-gnu) Copyright (C) 2005 Free Software Foundation, Inc. # echo "`echo "foo"`" foo
Interesting.
Even more interesting is that the abovementioned "echo" command runs under AIX's ksh and /bin/sh just fine - but that's to be expected, the quotes just disappear, and then all you have left is
echo foo
which works :)
Things look different if you do this:
gd@hilb31:/s1/gcc-3.4.6/gcc/p/test> echo "`echo "(foo)"`" ksh: 0403-057 Syntax error: `(' is not expected. gd@hilb31:/s1/gcc-3.4.6/gcc/p/test> echo "`echo "(foo)"`" (foo)
- but you're right, bash doesn't care one way or the other.
I think it's not so much about being picky, but supporting a slightly extended syntax ("" within `` pairs, while ksh apparently considers the first unquoted " to be the closing one without regard to nesting). But anyway, the extra 's don't hurt bash (and I hope no other shell either).
Unfortunately it's not so easy. NetBSD's ksh does it just the other way:
gert@kirk:/rhome/gert$ echo "`echo "(foo)"`" /bin/ksh: syntax error: `(' unexpected gert@kirk:/rhome/gert$ echo "`echo "(foo)"`" (foo)
*argh*
so maybe portable code really should avoid using the same quote character on different levels. Which means, the "right" thing to do would be:
echo "$PC `$PC $PFLAGS -dumpversion`, flags: $PFLAGS_NO_PATHS `if [ x"$GP" != x ]; then echo '(using GP)'; fi`"
- which seems to be fully portable to all shells I have tried.
After that, the test suite starts, but *all* test programs fail:
"gmake pascal.check-long" explains what is going wrong:
Test Run By gd on 2006-05-19 13:43:03 Native configuration is powerpc-ibm-aix5.3.0.0 (hilb31) /s1/gpc-build-20060325-3.4.6/gcc/xgpc -B/s1/gpc-build-20060325-3.4.6/gcc/ 20060325, based on gcc-3.4.6, flags: -g -O3 -W -Wall -Wno-unused GPC-TEST-BEGIN ========================== TEST abso1.pas: cc1: warning: command line option "-funit-path=/gnulocal/lib/gcc/powerpc-ibm-aix5.3.0.0/3.4.6/units" is valid for Pascal but not for C cc1: warning: command line option "-fno-unit-path" is valid for Pascal but not for C cc1: warning: command line option "-funit-path=/s1/gcc-3.4.6/gcc/p/units" is valid for Pascal but not for C cc1: warning: command line option "-fautobuild" is valid for Pascal but not for C cc1: warning: command line option "-funit-path=/s1/gcc-3.4.6/gcc/p/test" is valid for Pascal but not for C cc1: warning: command line option "-funit-path=/s1/gcc-3.4.6/gcc/p/test/../rts" is valid for Pascal but not for C cc1: warning: command line option "-funit-path=/s1/gcc-3.4.6/gcc/p/test/../units" is valid for Pascal but not for C cc1: warning: command line option "-fexecutable-path=." is valid for Pascal but not for C OK
I'm not sure how to proceed here. Why is it calling cc1? Why is it passing options that the backend doesn't like? Is this something that gcc-3.4.6 has changed?
For debugging, you could insert an echo statement in test_run, to find out how exactly it invokes GPC, then try this command-line manually, and if it still fails, play with the options to find out what's causing this.
The relevant line for most test programs (including abso1) is:
if { $PC_WITH_FLAGS -Werror "$1"; } 2>&1; then
Note there are some similar looking lines, this is line 254. So you could put before it:
echo $PC_WITH_FLAGS -Werror "$1"
OK, here we go. This is how it's called:
---PC_WITH_FLAGS--- /s1/gpc-build-20060325-3.4.6/gcc/xgpc -B/s1/gpc-build-20060325-3.4.6/gcc/ --unit-path=/gnulocal/lib/gcc/powerpc-ibm-aix5.3.0.0/3.4.6/units -I /gnulocal/lib/gcc/powerpc-ibm-aix5.3.0.0/3.4.6/units -I ../rts --no-unit-path --unit-path=/s1/gcc-3.4.6/gcc/p/units --autobuild -g -O3 -W -Wall -Wno-unused -o a.out --unit-path=/s1/gcc-3.4.6/gcc/p/test --unit-path=/s1/gcc-3.4.6/gcc/p/test/../rts --unit-path=/s1/gcc-3.4.6/gcc/p/test/../units -I /s1/gcc-3.4.6/gcc/p/test -I /s1/gcc-3.4.6/gcc/p/test/../units --executable-path=. -Werror /s1/gcc-3.4.6/gcc/p/test/abso1.pas ---PC_WITH_FLAGS---
If I run that on "hello.pas" I get the same warnings from "cc1".
If I remove all "--unit-path" directives, and the "--executable-path" and "--no-unit-path" directives, the warnings are gone (which was to be expected, but isn't very enlightening).
Adding "-v" to the gpc command line suggests that the warnings might come from "collect2":
... GNU Pascal Compiler PreProcessor version 20060325, based on gcc-3.4.6
{$include "..."} search starts here: {$include <...>} search starts here: /gnulocal/lib/gcc/powerpc-ibm-aix5.3.0.0/3.4.6/units ../rts /s1/gcc-3.4.6/gcc/p/test /s1/gcc-3.4.6/gcc/p/test/../units End of search list. as -u -mppc -o /tmp//cchPIwsI.o /tmp//cckcaRBw.s /s1/gpc-build-20060325-3.4.6/gcc/collect2 -bpT:0x10000000 -bpD:0x20000000 -btextro -bnodelcsect -bexport:/usr/lib/libg.exp -o a.out /lib/crt0.o -L/s1/gpc-build-20060325-3.4.6/gcc -L/gnulocal/lib/gcc/powerpc-ibm-aix5.3.0.0/3.4.6 -L/gnulocal/lib/gcc/powerpc-ibm-aix5.3.0.0/3.4.6/../../.. /tmp//cchPIwsI.o -lgpc -lm /s1/gpc-build-20060325-3.4.6/gcc/libgcc.a /s1/gpc-build-20060325-3.4.6/gcc/libgcc_eh.a -lg -lc /s1/gpc-build-20060325-3.4.6/gcc/libgcc.a /s1/gpc-build-20060325-3.4.6/gcc/libgcc_eh.a cc1: warning: command line option "-funit-path=/gnulocal/lib/gcc/powerpc-ibm-aix5.3.0.0/3.4.6/units" is valid for Pascal but not for C cc1: warning: command line option "-fno-unit-path" is valid for Pascal but not for C cc1: warning: command line option "-funit-path=/s1/gcc-3.4.6/gcc/p/units" is valid for Pascal but not for C cc1: warning: command line option "-fautobuild" is valid for Pascal but not for C cc1: warning: command line option "-funit-path=/s1/gcc-3.4.6/gcc/p/test" is valid for Pascal but not for C cc1: warning: command line option "-funit-path=/s1/gcc-3.4.6/gcc/p/test/../rts" is valid for Pascal but not for C
Which is backed by the fact that if I run GPC als "compile-only" (gpc -c), I don't get any warnings.
I still don't understand it, though. Where does collect2 get these options from? Are they included in the .o file?
Compiling a simple "hello,world" program works, with no warnings:
gd@hilb31:/tmp> gpc -Wall -o hello hello.pas gd@hilb31:/tmp> ./hello Hello, World
BTW, you made sure this is the newly installed GPC here, not an older version, did you?
Yes, there was no gpc on that machine beforehand.
It has the same problems, though, when I add some of the triggering options:
gd@hilb31:/tmp> /gnulocal/bin/gpc -Wall -o hello hello.pas gd@hilb31:/tmp> ./hello Hello, World
gd@hilb31:/tmp> /gnulocal/bin/gpc -Wall --no-unit-path -o hello hello.pas cc1: warning: command line option "-fno-unit-path" is valid for Pascal but not for C gd@hilb31:/tmp> ./hello Hello, World
So - what can I try next?
regards,
gert