public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
* Re:  Problem with Ada working on Linux PowerPC port
@ 2001-11-04 15:27 Richard Kenner
  2001-11-04 18:49 ` Corey Minyard
  0 siblings, 1 reply; 6+ messages in thread
From: Richard Kenner @ 2001-11-04 15:27 UTC (permalink / raw)
  To: minyard; +Cc: gcc

    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?

    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.

    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.

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Problem with Ada working on Linux PowerPC port
  2001-11-04 15:27 Problem with Ada working on Linux PowerPC port Richard Kenner
@ 2001-11-04 18:49 ` Corey Minyard
  2001-11-05  3:47   ` guerby
  0 siblings, 1 reply; 6+ messages in thread
From: Corey Minyard @ 2001-11-04 18:49 UTC (permalink / raw)
  To: Richard Kenner; +Cc: gcc

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

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Problem with Ada working on Linux PowerPC port
  2001-11-04 18:49 ` Corey Minyard
@ 2001-11-05  3:47   ` guerby
  0 siblings, 0 replies; 6+ messages in thread
From: guerby @ 2001-11-05  3:47 UTC (permalink / raw)
  To: minyard; +Cc: kenner, gcc

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

This way of doing things is I believe deprecated, the correct way to
enable Ada is to configure with --enable-languages=c,ada (unless I'm
missing something special to cross).

-- 
Laurent Guerby <guerby@acm.org>

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Problem with Ada working on Linux PowerPC port
  2001-11-04  9:09 ` Corey Minyard
@ 2001-11-07 11:44   ` Olivier Hainque
  0 siblings, 0 replies; 6+ messages in thread
From: Olivier Hainque @ 2001-11-07 11:44 UTC (permalink / raw)
  To: Corey Minyard; +Cc: gcc


Hello Corey,

It seems like part of your message has not been answered yet ...

Corey Minyard <minyard@acm.org> writes:
> Also, is anyone working on the dwarf frame unwinding for GNAT?

Yes, we are actively working to implement exception handling using the GCC
framework and already have significant results for a couple of targets.

Parts of the changes involved have been checked-in the GCC tree recently (see
e.g. except.c).

Other changes at both the compiler and runtime library levels are necessary to
have the whole thing working and these are in the "integration pipeline" :)

Olivier


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Problem with Ada working on Linux PowerPC port
  2001-11-04  8:33 Corey Minyard
@ 2001-11-04  9:09 ` Corey Minyard
  2001-11-07 11:44   ` Olivier Hainque
  0 siblings, 1 reply; 6+ messages in thread
From: Corey Minyard @ 2001-11-04  9:09 UTC (permalink / raw)
  To: gcc

I forgot to mention a couple of other things.  The following patch was 
necessary to get the thing to compile for a PPC target:

diff -u -r1.12 misc.c
--- misc.c      2001/11/15 10:00:53     1.12
+++ misc.c      2001/11/16 03:17:34
@@ -744,10 +744,13 @@
   enum machine_mode sa_mode = Pmode;
   rtx stack_save;
 
+#if 0 /* This seems to be broken, at least on PowerPC.  - Corey Minyard */
 #ifdef HAVE_save_stack_nonlocal
   if (HAVE_save_stack_nonlocal)
     sa_mode = insn_operand_mode[(int) CODE_FOR_save_stack_nonlocal][0];
 #endif
+#endif
+
 #ifdef STACK_SAVEAREA_MODE
   sa_mode = STACK_SAVEAREA_MODE (SAVE_NONLOCAL);
 #endif

The save stack stuff has changed completely, and the call below it will 
just override it anyway on the PPC, anyway.


Also, is anyone working on the dwarf frame unwinding for GNAT?


-Corey




^ permalink raw reply	[flat|nested] 6+ messages in thread

* Problem with Ada working on Linux PowerPC port
@ 2001-11-04  8:33 Corey Minyard
  2001-11-04  9:09 ` Corey Minyard
  0 siblings, 1 reply; 6+ messages in thread
From: Corey Minyard @ 2001-11-04  8:33 UTC (permalink / raw)
  To: gcc

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 
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"

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

-Corey

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,


^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2001-11-19 11:11 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2001-11-04 15:27 Problem with Ada working on Linux PowerPC port Richard Kenner
2001-11-04 18:49 ` Corey Minyard
2001-11-05  3:47   ` guerby
  -- strict thread matches above, loose matches on Subject: below --
2001-11-04  8:33 Corey Minyard
2001-11-04  9:09 ` Corey Minyard
2001-11-07 11:44   ` Olivier Hainque

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).