public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [trunk][patch] fix invalid sharing in see
@ 2008-05-22 13:17 Rafael Espindola
  2008-05-22 13:59 ` Rafael Espindola
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Rafael Espindola @ 2008-05-22 13:17 UTC (permalink / raw)
  To: GCC Patches; +Cc: Ian Lance Taylor

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

The attached patch fixes an invalid rtl sharing in see. A test is
attached, to reproduce run on a x86_64

./cc1plus -fsee -O2 test.ii

I would like to add test.ii to the testsuite. Where should it go?

OK if bootstraps and regression tests are OK?

* see.c (see_pre_insert_extensions): Use copy_rtx to avoid invalid rtx sharing.

Cheers,
-- 
Rafael Avila de Espindola

Google Ireland Ltd.
Gordon House
Barrow Street
Dublin 4
Ireland

Registered in Dublin, Ireland
Registration Number: 368047

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: see-fix.patch --]
[-- Type: text/x-patch; name=see-fix.patch, Size: 374 bytes --]

diff --git a/gcc/see.c b/gcc/see.c
index 6e5260b..8002cde 100644
--- a/gcc/see.c
+++ b/gcc/see.c
@@ -1687,7 +1687,7 @@ see_pre_insert_extensions (struct see_pre_extension_expr **index_map)
 
 		start_sequence ();
 		emit_insn (PATTERN (expr->se_insn));
-		se_insn = get_insns ();
+		se_insn = copy_rtx (get_insns ());
 		end_sequence ();
 
 		if (eg->flags & EDGE_ABNORMAL)

[-- Attachment #3: test.ii --]
[-- Type: application/octet-stream, Size: 314 bytes --]

bool f(const char* ptr, int bar) {
  return (((const char *)0 - ptr ) & (bar - 1)) == 0;
}


int g(const char* ptr, const char *test, int N, int bar)  {
  if (N == 0) {
  }
  else if (N > 0) {
    int count = 0;
    while ( count < N) {
      if (!f(ptr, bar))
        count++;
    }
  }
  return f(test, bar) ;
}

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

* Re: [trunk][patch] fix invalid sharing in see
  2008-05-22 13:17 [trunk][patch] fix invalid sharing in see Rafael Espindola
@ 2008-05-22 13:59 ` Rafael Espindola
  2008-05-22 14:21 ` Ian Lance Taylor
  2008-05-23 16:29 ` Eric Botcazou
  2 siblings, 0 replies; 6+ messages in thread
From: Rafael Espindola @ 2008-05-22 13:59 UTC (permalink / raw)
  To: GCC Patches; +Cc: Ian Lance Taylor

> OK if bootstraps and regression tests are OK?

bootstraps and regression tests pass.

Cheers,
-- 
Rafael Avila de Espindola

Google Ireland Ltd.
Gordon House
Barrow Street
Dublin 4
Ireland

Registered in Dublin, Ireland
Registration Number: 368047

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

* Re: [trunk][patch] fix invalid sharing in see
  2008-05-22 13:17 [trunk][patch] fix invalid sharing in see Rafael Espindola
  2008-05-22 13:59 ` Rafael Espindola
@ 2008-05-22 14:21 ` Ian Lance Taylor
  2008-05-23 16:29 ` Eric Botcazou
  2 siblings, 0 replies; 6+ messages in thread
From: Ian Lance Taylor @ 2008-05-22 14:21 UTC (permalink / raw)
  To: Rafael Espindola; +Cc: GCC Patches

"Rafael Espindola" <espindola@google.com> writes:

> diff --git a/gcc/see.c b/gcc/see.c
> index 6e5260b..8002cde 100644
> --- a/gcc/see.c
> +++ b/gcc/see.c
> @@ -1687,7 +1687,7 @@ see_pre_insert_extensions (struct see_pre_extension_expr **index_map)
>  
>  		start_sequence ();
>  		emit_insn (PATTERN (expr->se_insn));
> -		se_insn = get_insns ();
> +		se_insn = copy_rtx (get_insns ());
>  		end_sequence ();
>  
>  		if (eg->flags & EDGE_ABNORMAL)


This should be:
    start_sequence ();
    emit_insn (copy_insn (PATTERN (expr->se_insn)));
    se_insn = get_insns ();
    end_sequence ();

That patch is approved if it passes bootstrap and testing.

The test case should go into gcc/testsuite/gcc.c-torture/compile.  If
there is no PR number, then the name should be DATE-1.c.  See the
other files in that directory.

Don't forget the ChangeLog entry.

Thanks for tracking this down.

Ian

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

* Re: [trunk][patch] fix invalid sharing in see
  2008-05-22 13:17 [trunk][patch] fix invalid sharing in see Rafael Espindola
  2008-05-22 13:59 ` Rafael Espindola
  2008-05-22 14:21 ` Ian Lance Taylor
@ 2008-05-23 16:29 ` Eric Botcazou
  2008-05-23 18:43   ` Ian Lance Taylor
  2 siblings, 1 reply; 6+ messages in thread
From: Eric Botcazou @ 2008-05-23 16:29 UTC (permalink / raw)
  To: Rafael Espindola; +Cc: gcc-patches, Ian Lance Taylor

> The attached patch fixes an invalid rtl sharing in see. A test is
> attached, to reproduce run on a x86_64
>
> ./cc1plus -fsee -O2 test.ii
>
> I would like to add test.ii to the testsuite. Where should it go?

There is a couple of problems:

- the testcase is in testsuite/gcc.c-torture/compile but it uses dg-options
so it gets compiled multiple times for little benefit (see the log file).
I think it ought to be in gcc.dg instead.

- the testcase doesn't pass with RTL checking on x86:
/home/eric/svn/gcc/gcc/testsuite/gcc.c-torture/compile/20080522-1.c: In 
function 'g':
/home/eric/svn/gcc/gcc/testsuite/gcc.c-torture/compile/20080522-1.c:20: 
internal compiler error: RTL check: expected code 'subreg', have 'pc' in 
see_get_extension_data, at see.c:735
Please submit a full bug report,
with preprocessed source if appropriate.
See <http://gcc.gnu.org/bugs.html> for instructions.

-- 
Eric Botcazou

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

* Re: [trunk][patch] fix invalid sharing in see
  2008-05-23 16:29 ` Eric Botcazou
@ 2008-05-23 18:43   ` Ian Lance Taylor
  2008-05-23 18:44     ` Rafael Espindola
  0 siblings, 1 reply; 6+ messages in thread
From: Ian Lance Taylor @ 2008-05-23 18:43 UTC (permalink / raw)
  To: Eric Botcazou; +Cc: Rafael Espindola, gcc-patches

Eric Botcazou <ebotcazou@adacore.com> writes:

> - the testcase is in testsuite/gcc.c-torture/compile but it uses dg-options
> so it gets compiled multiple times for little benefit (see the log file).
> I think it ought to be in gcc.dg instead.

Ah, you're right, sorry.

Ian

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

* Re: [trunk][patch] fix invalid sharing in see
  2008-05-23 18:43   ` Ian Lance Taylor
@ 2008-05-23 18:44     ` Rafael Espindola
  0 siblings, 0 replies; 6+ messages in thread
From: Rafael Espindola @ 2008-05-23 18:44 UTC (permalink / raw)
  To: Ian Lance Taylor; +Cc: Eric Botcazou, gcc-patches

2008/5/23 Ian Lance Taylor <iant@google.com>:
> Eric Botcazou <ebotcazou@adacore.com> writes:
>
> Ah, you're right, sorry.

I left trunk bootstrapping with --enable-checking at work. Will try to
fix the problem and move the test in a moment.

> Ian
>

Cheers,
-- 
Rafael Avila de Espindola

Google Ireland Ltd.
Gordon House
Barrow Street
Dublin 4
Ireland

Registered in Dublin, Ireland
Registration Number: 368047

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

end of thread, other threads:[~2008-05-23 18:16 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-05-22 13:17 [trunk][patch] fix invalid sharing in see Rafael Espindola
2008-05-22 13:59 ` Rafael Espindola
2008-05-22 14:21 ` Ian Lance Taylor
2008-05-23 16:29 ` Eric Botcazou
2008-05-23 18:43   ` Ian Lance Taylor
2008-05-23 18:44     ` Rafael Espindola

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