public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH,testsuite] fix gcc.dg/tree-ssa/wholeprogram-1.c for -fPIC
@ 2007-07-25 18:02 Nathan Froyd
  2007-07-25 18:22 ` Kaveh R. GHAZI
  0 siblings, 1 reply; 5+ messages in thread
From: Nathan Froyd @ 2007-07-25 18:02 UTC (permalink / raw)
  To: gcc-patches

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

The attached patch resolves a problem with
gcc.dg/tree-ssa/wholeprogram-1.c and testing with -fPIC.  With -fPIC,
the inliner believes that large_function is not eligible for inlining
because global symbols can be overridden from other modules, which
causes the testcase to fail.  The simplest solution is to mark
large_function as static, thereby ensuring that large_function is a
local symbol rather than a global one.

Tested on powerpc-wrs-vxworks with and without -fPIC.  No regressions.
OK to commit?

-Nathan

2007-07-25  Nathan Froyd  <froydnj@codesourcery.com>

	gcc/testsuite/
	* gcc.dg/tree-ssa/wholeprogram-1.c (large_function): Declare as
	static to ensure it gets inlined even when -fPIC.



[-- Attachment #2: wholeprogram.patch --]
[-- Type: text/plain, Size: 359 bytes --]

Index: gcc/testsuite/gcc.dg/tree-ssa/wholeprogram-1.c
===================================================================
--- gcc/testsuite/gcc.dg/tree-ssa/wholeprogram-1.c	(revision 177249)
+++ gcc/testsuite/gcc.dg/tree-ssa/wholeprogram-1.c	(working copy)
@@ -2,7 +2,7 @@
 int b[100];
 void abort (void);
 
-void
+static void
 large_function ()
 {
   int i;

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

* Re: [PATCH,testsuite] fix gcc.dg/tree-ssa/wholeprogram-1.c for -fPIC
  2007-07-25 18:02 [PATCH,testsuite] fix gcc.dg/tree-ssa/wholeprogram-1.c for -fPIC Nathan Froyd
@ 2007-07-25 18:22 ` Kaveh R. GHAZI
  2007-07-25 20:33   ` Nathan Froyd
  0 siblings, 1 reply; 5+ messages in thread
From: Kaveh R. GHAZI @ 2007-07-25 18:22 UTC (permalink / raw)
  To: Nathan Froyd; +Cc: gcc-patches

On Wed, 25 Jul 2007, Nathan Froyd wrote:

> The attached patch resolves a problem with
> gcc.dg/tree-ssa/wholeprogram-1.c and testing with -fPIC.  With -fPIC,
> the inliner believes that large_function is not eligible for inlining
> because global symbols can be overridden from other modules, which
> causes the testcase to fail.  The simplest solution is to mark
> large_function as static, thereby ensuring that large_function is a
> local symbol rather than a global one.
>
> Tested on powerpc-wrs-vxworks with and without -fPIC.  No regressions.
> OK to commit?
>
> -Nathan
>
> 2007-07-25  Nathan Froyd  <froydnj@codesourcery.com>
>
> 	gcc/testsuite/
> 	* gcc.dg/tree-ssa/wholeprogram-1.c (large_function): Declare as
> 	static to ensure it gets inlined even when -fPIC.

This is PR25445.  Can you address Andrew's comment in the PR?  He seem to
say that this is a compiler bug, not a testsuite bug.

		Thanks,
		--Kaveh
--
Kaveh R. Ghazi			ghazi@caip.rutgers.edu

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

* Re: [PATCH,testsuite] fix gcc.dg/tree-ssa/wholeprogram-1.c for -fPIC
  2007-07-25 18:22 ` Kaveh R. GHAZI
@ 2007-07-25 20:33   ` Nathan Froyd
  2007-07-26 21:13     ` Kaveh R. GHAZI
  2007-08-02  1:22     ` Mark Mitchell
  0 siblings, 2 replies; 5+ messages in thread
From: Nathan Froyd @ 2007-07-25 20:33 UTC (permalink / raw)
  To: Kaveh R. GHAZI; +Cc: gcc-patches

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

On Wed, Jul 25, 2007 at 02:09:13PM -0400, Kaveh R. GHAZI wrote:
> > The attached patch resolves a problem with
> > gcc.dg/tree-ssa/wholeprogram-1.c and testing with -fPIC.
> 
> This is PR25445.  Can you address Andrew's comment in the PR?  He seem to
> say that this is a compiler bug, not a testsuite bug.

Ah, so it is.  This patch seems like it fixes the problem.

Bootstrapped and lightly tested (tree-ssa.exp=wholeprogram-1.c) on
powerpc-wrs-vxworks.  Does this look sound?  If so, I will bootstrap and
ensure no regressions on a more conventional platform.

-Nathan

gcc/
2007-07-25  Nathan Froyd  <froydnj@codesourcery.com>

	PR/25445
	* varasm.c (default_binds_local_p_1): Consult flag_whole_program
	if we are compiling with -fPIC.



[-- Attachment #2: wholeprogram.patch --]
[-- Type: text/plain, Size: 756 bytes --]

Index: gcc/varasm.c
===================================================================
--- gcc/varasm.c	(revision 177249)
+++ gcc/varasm.c	(working copy)
@@ -6033,9 +6033,10 @@ default_binds_local_p_1 (tree exp, int s
   else if (DECL_VISIBILITY (exp) != VISIBILITY_DEFAULT)
     local_p = true;
   /* If PIC, then assume that any global name can be overridden by
-     symbols resolved from other modules.  */
+     symbols resolved from other modules, unless we are compiling with
+     -fwhole-program, which assumes that names are local.  */
   else if (shlib)
-    local_p = false;
+    local_p = flag_whole_program;
   /* Uninitialized COMMON variable may be unified with symbols
      resolved from other modules.  */
   else if (DECL_COMMON (exp)

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

* Re: [PATCH,testsuite] fix gcc.dg/tree-ssa/wholeprogram-1.c for -fPIC
  2007-07-25 20:33   ` Nathan Froyd
@ 2007-07-26 21:13     ` Kaveh R. GHAZI
  2007-08-02  1:22     ` Mark Mitchell
  1 sibling, 0 replies; 5+ messages in thread
From: Kaveh R. GHAZI @ 2007-07-26 21:13 UTC (permalink / raw)
  To: Nathan Froyd; +Cc: gcc-patches

On Wed, 25 Jul 2007, Nathan Froyd wrote:

> On Wed, Jul 25, 2007 at 02:09:13PM -0400, Kaveh R. GHAZI wrote:
> > > The attached patch resolves a problem with
> > > gcc.dg/tree-ssa/wholeprogram-1.c and testing with -fPIC.
> >
> > This is PR25445.  Can you address Andrew's comment in the PR?  He seem to
> > say that this is a compiler bug, not a testsuite bug.
>
> Ah, so it is.  This patch seems like it fixes the problem.
>
> Bootstrapped and lightly tested (tree-ssa.exp=wholeprogram-1.c) on
> powerpc-wrs-vxworks.  Does this look sound?  If so, I will bootstrap and
> ensure no regressions on a more conventional platform.
> -Nathan

Thanks for addressing this. Looks sound to me but that's not my area, and
I don't have approval rights.
		--Kaveh

>
> gcc/
> 2007-07-25  Nathan Froyd  <froydnj@codesourcery.com>
>
> 	PR/25445
> 	* varasm.c (default_binds_local_p_1): Consult flag_whole_program
> 	if we are compiling with -fPIC.

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

* Re: [PATCH,testsuite] fix gcc.dg/tree-ssa/wholeprogram-1.c for -fPIC
  2007-07-25 20:33   ` Nathan Froyd
  2007-07-26 21:13     ` Kaveh R. GHAZI
@ 2007-08-02  1:22     ` Mark Mitchell
  1 sibling, 0 replies; 5+ messages in thread
From: Mark Mitchell @ 2007-08-02  1:22 UTC (permalink / raw)
  To: Kaveh R. GHAZI, gcc-patches

Nathan Froyd wrote:

> 2007-07-25  Nathan Froyd  <froydnj@codesourcery.com>
> 
> 	PR/25445
> 	* varasm.c (default_binds_local_p_1): Consult flag_whole_program
> 	if we are compiling with -fPIC.

OK.

-- 
Mark Mitchell
CodeSourcery
mark@codesourcery.com
(650) 331-3385 x713

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

end of thread, other threads:[~2007-08-02  1:22 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-07-25 18:02 [PATCH,testsuite] fix gcc.dg/tree-ssa/wholeprogram-1.c for -fPIC Nathan Froyd
2007-07-25 18:22 ` Kaveh R. GHAZI
2007-07-25 20:33   ` Nathan Froyd
2007-07-26 21:13     ` Kaveh R. GHAZI
2007-08-02  1:22     ` Mark Mitchell

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