This is the mail archive of the mailing list for the GCC project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Problem with Ada working on Linux PowerPC port

I've been working on a PowerPC bootstrap of the GNAT stuff from the 3.1 
compiler (current CVS).  It bootstrapped beautifully on my x86 Linux 
box, passed my libraries suite of tests, and I've been using it that to 
cross-compile to the Linux PowerPC box.

The cross-compile had a problem where a declaration was being created 
with the wrong name in the assembler output in some cases with constant 
strings.  It was really wierd, because you could make the strings longer 
and the problem would go away.  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.

The following patch seems to fix the problem, everything in the compiler 
seems to work find with it.  It forces the first variable creation call 
to create the assembler output.  However, the code here is subtle (as 
all of gcc) so it might have side effects I don't understand.

Now the compiler cross-compiles fine, but on the PPC machine I get the 

gcc -c -g   -W -Wall -gnatpg -gnata -I- -I. -I../../../gcc/gcc/ada 
../../../gcc/gcc/ada/ warning: file name does not match unit name, should 
be ""

which is obviously bogus.  Oh, well, one more thing.


here's the patch:

diff -u -r1.8 decl.c
--- decl.c      2001/10/30 21:33:07     1.8
+++ decl.c      2001/11/16 03:17:28
@@ -1011,7 +1011,10 @@
            && (AGGREGATE_TYPE_P (gnu_type)
                && ! (TREE_CODE (gnu_type) == RECORD_TYPE
                      && TYPE_IS_PADDING_P (gnu_type))))
-      static_p = 1;
+      {
+        static_p = 1;
+        const_flag = 0;
+      }
        set_lineno (gnat_entity, ! global_bindings_p ());
        gnu_decl = create_var_decl (gnu_entity_id, gnu_ext_name, gnu_type,

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]