Problem with Ada working on Linux PowerPC port

Corey Minyard minyard@acm.org
Sun Nov 4 18:49:00 GMT 2001


Richard Kenner wrote:

>    I think I have traced the problem down to ada/decl.c.  Around line
>    1020 a variable declaration is created, then around 1048 the same
>    variable is created again (for other reasons, it seems) as a
>    corresponding declaration.  However, the "const_flag" is not passed in
>    to the second variable creation.  This caused the second declaration
>    to create the assembler output with one name, but everything else
>    referenced the first variable (thus the first name).  You can't pass
>    const_flag into the second call because it won't create the assembler
>    output at all.
>
>I can't follow this.  Can you send a test case?
>
You will have to build a cross compiler, since it works fine on a full 
bootstrap of x86 (which is also a little wierd).  It occurs on the 
building of the Bindgen and Par packages.  In Bindgen, the string "_00" 
(only occurence in the package) is where the problem occurs.

To build the cross compiler, the following was in config.status:
  ../gcc/configure 
--with-gcc-version-trigger=/home/minyard/gcc/3.1/gcc/gcc/version.c 
--host=i686-pc-linux-gnu  --target=ppc-linux-gnu 
--prefix=/home/minyard/gcc/3.1/ppc-cross --norecursion

Then cd to libiberty and make, then cd to gcc and do a "make 
LANGUAGES="c ada".

To reproduce the problem, cd to the gcc/ada directory with the source 
and do:
 <path to new gnat>/gnat1 -I- -I. -I../../../gcc/gcc/ada -quiet 
-dumpbase bindgen.adb -g -gnatpg -gnata -W -Wall bindgen.adb -o bindgen.s

Then search for "_00" in bindgen.s.  It will be labelled "suffix.15", 
but the next thing (I believe labelled .LC674) will have a reference to 
".LC673", which should be  "suffix.15", or vice versa.

Hopefully that's not too obfuscated.

>
>
>    The following patch seems to fix the problem, 
>
>Of course you don't want to turn off const_flag like that, so we need
>to find the real problem.
>
It seems to me that the "const_flag" passed in to create_var_decl causes 
create_var_decl to not create a memory instance of the constant.  If 
that's the case my patch is correct.  "const_flag" is not passed in to 
the second call to create_var_decl, which seems a little strange, too.

>
>
>    Now the compiler cross-compiles fine, but on the PPC machine I get the 
>    error:
>
>    gcc -c -g   -W -Wall -gnatpg -gnata -I- -I. -I../../../gcc/gcc/ada 
>    ../../../gcc/gcc/ada/a-charac.ads
>    a-charac.ads:19:12: warning: file name does not match unit name, should 
>    be "a-chara.ads"
>
>Interesting.  This was also reported on IA64.  However, GNAT has been
>built on PowerPC before, so this is strange.  Clearly something is being
>miscompiled, but the question is what.
>

I can't work on this over the weekend, unfortunately, but I'll work on 
it next week if nobody has solved it since.

-Corey



More information about the Gcc mailing list