public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH] Fix PR middle-end/17813
@ 2004-10-16 21:22 Eric Botcazou
  2004-10-17  1:28 ` Roger Sayle
                   ` (2 more replies)
  0 siblings, 3 replies; 23+ messages in thread
From: Eric Botcazou @ 2004-10-16 21:22 UTC (permalink / raw)
  To: gcc-patches

[-- Attachment #1: Type: text/plain, Size: 652 bytes --]

Hi,

This is the Ada compiler bootstrap failure on i586 and below, which again 
pertains to stack adjustments.  cstand.adb:Create_Standard is miscompiled 
because a stack adjustment is emitted right after a __builtin_stack_restore.

The proposed fix is to emit pending stack adjustments right before 
__builtin_stack_save and __builtin_stack_restore.  Bootstrapped on 
i586-mandrake-linux-gnu (with the workaround for PR tree-opt/17986).
OK for mainline?


2004-10-16  Eric Botcazou  <ebotcazou@libertysurf.fr>

	PR middle-end/17813
	* explow.c (emit_stack_save): Emit pending stack adjustments.
	(emit_stack_restore): Likewise.


-- 
Eric Botcazou


[-- Attachment #2: pr17813.diff --]
[-- Type: text/x-diff, Size: 1301 bytes --]

Index: explow.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/explow.c,v
retrieving revision 1.139
diff -u -p -r1.139 explow.c
--- explow.c	8 Sep 2004 08:05:13 -0000	1.139
+++ explow.c	16 Oct 2004 16:41:55 -0000
@@ -965,6 +965,7 @@ emit_stack_save (enum save_level save_le
       rtx seq;
 
       start_sequence ();
+      do_pending_stack_adjust ();
       /* We must validize inside the sequence, to ensure that any instructions
 	 created by the validize call also get moved to the right place.  */
       if (sa != 0)
@@ -976,6 +977,7 @@ emit_stack_save (enum save_level save_le
     }
   else
     {
+      do_pending_stack_adjust ();
       if (sa != 0)
 	sa = validize_mem (sa);
       emit_insn (fcn (sa, stack_pointer_rtx));
@@ -1037,13 +1039,17 @@ emit_stack_restore (enum save_level save
       rtx seq;
 
       start_sequence ();
+      do_pending_stack_adjust ();
       emit_insn (fcn (stack_pointer_rtx, sa));
       seq = get_insns ();
       end_sequence ();
       emit_insn_after (seq, after);
     }
   else
-    emit_insn (fcn (stack_pointer_rtx, sa));
+    {
+      do_pending_stack_adjust ();
+      emit_insn (fcn (stack_pointer_rtx, sa));
+    }
 }
 
 /* Invoke emit_stack_save on the nonlocal_goto_save_area for the current

^ permalink raw reply	[flat|nested] 23+ messages in thread
* Re: [PATCH] Fix PR middle-end/17813
@ 2004-10-17 18:48 Richard Kenner
  2004-10-18  8:22 ` Eric Botcazou
  0 siblings, 1 reply; 23+ messages in thread
From: Richard Kenner @ 2004-10-17 18:48 UTC (permalink / raw)
  To: ebotcazou; +Cc: gcc-patches

    OK, I could reproduce with i486-linux.  The bad news is that the
    stage2 Ada front-end appears to be miscompiled by the stage1 compiler
    and that there is currently no Ada-aware debugger that understands
    location lists...

I'm also seeing a miscompilation of gnatmake.

But there are still ACATS execution failures, so I'm hoping that fixing
those will fix these issues.  I hope to get back to that task shortly.

^ permalink raw reply	[flat|nested] 23+ messages in thread
* Re: [PATCH] Fix PR middle-end/17813
@ 2004-10-18 14:56 Richard Kenner
  2004-10-18 16:03 ` Eric Botcazou
  0 siblings, 1 reply; 23+ messages in thread
From: Richard Kenner @ 2004-10-18 14:56 UTC (permalink / raw)
  To: ebotcazou; +Cc: gcc-patches

    Do you mean an infinite loop compiling make.adb?  

Nope.  I mean gnatmake blowing up building gnatmem and also in a few of the C2
ACATS tests.  This is on x86-64.

    Please assign it to you if you're working on it, this will avoid
    parallel work.

And, as I said, I'm not working on it yet: I want to fix the recent ACATS
regressions first and hope that gets fixed in the process.

^ permalink raw reply	[flat|nested] 23+ messages in thread
* Re: [PATCH] Fix PR middle-end/17813
@ 2004-10-18 17:18 Richard Kenner
  2004-10-18 20:56 ` Eric Botcazou
  0 siblings, 1 reply; 23+ messages in thread
From: Richard Kenner @ 2004-10-18 17:18 UTC (permalink / raw)
  To: ebotcazou; +Cc: gcc-patches

    Of course, but for debugging a miscompilation of the Ada scanner (e.g.
    PR middle-end/18045), having "pn" at hand is almost required if you
    are not familiar with the internal structure of the front-end
    (e.g. how to walk the node hierarchy) like me.

But that doesn't need an Ada-aware debugger!  I use that all the time
with non-Ada-aware debuggers.  Just do

define pn
set pn($)
end

^ permalink raw reply	[flat|nested] 23+ messages in thread
* Re: [PATCH] Fix PR middle-end/17813
@ 2004-10-18 21:04 Richard Kenner
  0 siblings, 0 replies; 23+ messages in thread
From: Richard Kenner @ 2004-10-18 21:04 UTC (permalink / raw)
  To: ebotcazou; +Cc: gcc-patches

    I obviously missed something.  So the debug functions are exposed by
    the front-end through a C interface?  

No.  There's a pragma Export giving that name.

    More generally, is a non-Ada-aware debugger sufficient to debug the Ada
    part of the front-end?

Pretty much. I don't do work in that code, but the few times I've had to look
at it, I've had no problems.  I only very recently started using an Ada-aware
debugger.  You just have to know a lot about how things are encoded, but
I'm sure you do!

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

end of thread, other threads:[~2004-10-18 22:07 UTC | newest]

Thread overview: 23+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-10-16 21:22 [PATCH] Fix PR middle-end/17813 Eric Botcazou
2004-10-17  1:28 ` Roger Sayle
2004-10-17  2:20   ` Jan Hubicka
2004-10-17 13:51   ` Eric Botcazou
2004-10-17 17:07     ` Roger Sayle
2004-10-17  9:58 ` Matthias Klose
2004-10-17 11:55   ` Eric Botcazou
2004-10-17 12:03     ` Matthias Klose
2004-10-17 17:57       ` Eric Botcazou
2004-10-17 19:40         ` Daniel Jacobowitz
2004-10-18 15:44           ` Eric Botcazou
2004-10-18 15:44             ` Arnaud Charlet
2004-10-18 16:30               ` Eric Botcazou
2004-10-18 12:16   ` Eric Botcazou
2004-10-18 22:11 ` Eric Botcazou
2004-10-17 18:48 Richard Kenner
2004-10-18  8:22 ` Eric Botcazou
2004-10-18 14:56 Richard Kenner
2004-10-18 16:03 ` Eric Botcazou
2004-10-18 17:18 Richard Kenner
2004-10-18 20:56 ` Eric Botcazou
2004-10-18 21:17   ` Laurent GUERBY
2004-10-18 21:04 Richard Kenner

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).