public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [patch] Preserve return statements at -O0
@ 2011-04-06  7:03 Eric Botcazou
  2011-04-06  9:18 ` Richard Guenther
  2011-04-06 18:07 ` Steven Bosscher
  0 siblings, 2 replies; 4+ messages in thread
From: Eric Botcazou @ 2011-04-06  7:03 UTC (permalink / raw)
  To: gcc-patches

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

Hi,

this patchlet ensures that return statements are preserved at -O0 so that you 
can put a breakpoint on them in the debugger.

Bootstrapped/regtested on x86_64-suse-linux, OK for the mainline?


2011-04-06  Eric Botcazou  <ebotcazou@adacore.com>

	* gimple-low.c (lower_gimple_return): When not optimizing, force
	labels associated with user returns to be preserved.


2011-04-06  Eric Botcazou  <ebotcazou@adacore.com>

	* gnat.dg/return3.adb: New test.


-- 
Eric Botcazou

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

Index: gimple-low.c
===================================================================
--- gimple-low.c	(revision 172018)
+++ gimple-low.c	(working copy)
@@ -758,6 +758,9 @@ lower_gimple_return (gimple_stmt_iterato
 
   /* Generate a goto statement and remove the return statement.  */
  found:
+  /* When not optimizing, make sure user returns are preserved.  */
+  if (!optimize && gimple_has_location (stmt))
+    DECL_ARTIFICIAL (tmp_rs.label) = 0;
   t = gimple_build_goto (tmp_rs.label);
   gimple_set_location (t, gimple_location (stmt));
   gimple_set_block (t, gimple_block (stmt));

[-- Attachment #3: return3.adb --]
[-- Type: text/x-adasrc, Size: 166 bytes --]

-- { dg-do compile { target *-*-linux* } }
-- { dg-options "-gdwarf-2 -dA" }

procedure Return3 is
begin
  return;
end;

-- { dg-final { scan-assembler "loc 1 6" } }

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

* Re: [patch] Preserve return statements at -O0
  2011-04-06  7:03 [patch] Preserve return statements at -O0 Eric Botcazou
@ 2011-04-06  9:18 ` Richard Guenther
  2011-04-06 18:07 ` Steven Bosscher
  1 sibling, 0 replies; 4+ messages in thread
From: Richard Guenther @ 2011-04-06  9:18 UTC (permalink / raw)
  To: Eric Botcazou; +Cc: gcc-patches

On Wed, Apr 6, 2011 at 8:57 AM, Eric Botcazou <ebotcazou@adacore.com> wrote:
> Hi,
>
> this patchlet ensures that return statements are preserved at -O0 so that you
> can put a breakpoint on them in the debugger.
>
> Bootstrapped/regtested on x86_64-suse-linux, OK for the mainline?

Ok.

Thanks,
Richard.

>
> 2011-04-06  Eric Botcazou  <ebotcazou@adacore.com>
>
>        * gimple-low.c (lower_gimple_return): When not optimizing, force
>        labels associated with user returns to be preserved.
>
>
> 2011-04-06  Eric Botcazou  <ebotcazou@adacore.com>
>
>        * gnat.dg/return3.adb: New test.
>
>
> --
> Eric Botcazou
>

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

* Re: [patch] Preserve return statements at -O0
  2011-04-06  7:03 [patch] Preserve return statements at -O0 Eric Botcazou
  2011-04-06  9:18 ` Richard Guenther
@ 2011-04-06 18:07 ` Steven Bosscher
  2011-04-06 18:29   ` Eric Botcazou
  1 sibling, 1 reply; 4+ messages in thread
From: Steven Bosscher @ 2011-04-06 18:07 UTC (permalink / raw)
  To: Eric Botcazou; +Cc: gcc-patches

On Wed, Apr 6, 2011 at 8:57 AM, Eric Botcazou <ebotcazou@adacore.com> wrote:
> this patchlet ensures that return statements are preserved at -O0 so that you
> can put a breakpoint on them in the debugger.

Isn't one of the effects of this patch to generate debug info for the
artificial label decl?

When I first saw your patch, I thought "FORCED_LABEL()", perhaps I'm
not sure that it's any better than your solution... Have you tried
that?

Ciao!
Steven

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

* Re: [patch] Preserve return statements at -O0
  2011-04-06 18:07 ` Steven Bosscher
@ 2011-04-06 18:29   ` Eric Botcazou
  0 siblings, 0 replies; 4+ messages in thread
From: Eric Botcazou @ 2011-04-06 18:29 UTC (permalink / raw)
  To: Steven Bosscher; +Cc: gcc-patches

> Isn't one of the effects of this patch to generate debug info for the
> artificial label decl?

No, DECL_IGNORED_P is preserved on the label decl.

> When I first saw your patch, I thought "FORCED_LABEL()", perhaps I'm
> not sure that it's any better than your solution... Have you tried
> that?

No, that isn't necessary at -O0 IMO, user labels are explicitly preserved.

-- 
Eric Botcazou

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

end of thread, other threads:[~2011-04-06 18:29 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-04-06  7:03 [patch] Preserve return statements at -O0 Eric Botcazou
2011-04-06  9:18 ` Richard Guenther
2011-04-06 18:07 ` Steven Bosscher
2011-04-06 18:29   ` Eric Botcazou

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