* [PATCH,testsuite] fix PR 19232
@ 2007-07-25 21:48 Nathan Froyd
2007-07-25 23:04 ` Janis Johnson
0 siblings, 1 reply; 2+ messages in thread
From: Nathan Froyd @ 2007-07-25 21:48 UTC (permalink / raw)
To: gcc-patches
[-- Attachment #1: Type: text/plain, Size: 700 bytes --]
The attached patch fixes PR 19232, which is a problem with -fPIC and
inlining. The compiler will not inline single-use functions that are
not declared inline with -fPIC, as those functions could be overridden
in other translation units.
The simplest fix seems to be to declare the relevant functions as
inline, since that is what the test intended. The compiler is then
perfectly happy to inline the functions, which triggers the intended
warnings.
Tested on powerpc-wrs-vxworks with and without -fPIC with no
regressions. OK to commit?
-Nathan
gcc/testsuite/
2007-07-25 Nathan Froyd <froydnj@codesourcery.com>
PR/19232
* gcc.dg/assign-warn-3.c (f0): Declare as inline.
(f1): Likewise.
[-- Attachment #2: assign-warn.patch --]
[-- Type: text/plain, Size: 829 bytes --]
Index: gcc/testsuite/gcc.dg/assign-warn-3.c
===================================================================
--- gcc/testsuite/gcc.dg/assign-warn-3.c (revision 177249)
+++ gcc/testsuite/gcc.dg/assign-warn-3.c (working copy)
@@ -5,9 +5,9 @@
/* { dg-options "-O3 -std=c99 -pedantic-errors" } */
/* This is valid to execute, so maybe shouldn't warn at all. */
-void f0(x) signed char *x; { }
+inline void f0(x) signed char *x; { }
void g0(unsigned char *x) { f0(x); } /* { dg-warning "warning: pointer targets in passing argument 1 of 'f0' differ in signedness" } */
/* This is undefined on execution but still must compile. */
-void f1(x) int *x; { }
+inline void f1(x) int *x; { }
void g1(unsigned int *x) { f1(x); } /* { dg-warning "warning: pointer targets in passing argument 1 of 'f1' differ in signedness" } */
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH,testsuite] fix PR 19232
2007-07-25 21:48 [PATCH,testsuite] fix PR 19232 Nathan Froyd
@ 2007-07-25 23:04 ` Janis Johnson
0 siblings, 0 replies; 2+ messages in thread
From: Janis Johnson @ 2007-07-25 23:04 UTC (permalink / raw)
To: Nathan Froyd; +Cc: gcc-patches
On Wed, 2007-07-25 at 13:52 -0700, Nathan Froyd wrote:
> The attached patch fixes PR 19232, which is a problem with -fPIC and
> inlining. The compiler will not inline single-use functions that are
> not declared inline with -fPIC, as those functions could be overridden
> in other translation units.
>
> The simplest fix seems to be to declare the relevant functions as
> inline, since that is what the test intended. The compiler is then
> perfectly happy to inline the functions, which triggers the intended
> warnings.
>
> Tested on powerpc-wrs-vxworks with and without -fPIC with no
> regressions. OK to commit?
OK.
Janis
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2007-07-25 22:53 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-07-25 21:48 [PATCH,testsuite] fix PR 19232 Nathan Froyd
2007-07-25 23:04 ` Janis Johnson
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).