* [rfa] store.exp failures
@ 2002-12-05 15:32 David Carlton
2002-12-05 16:19 ` Fernando Nasser
0 siblings, 1 reply; 8+ messages in thread
From: David Carlton @ 2002-12-05 15:32 UTC (permalink / raw)
To: gdb-patches; +Cc: Daniel Jacobowitz, Andrew Cagney, Fernando Nasser
Whoops, I should have sent this to gdb-patches instead of gdb.
On Thu, 5 Dec 2002 16:42:51 -0500, Daniel Jacobowitz <drow@mvista.com> said:
> On Thu, Dec 05, 2002 at 01:30:54PM -0800, David Carlton wrote:
>> So, basically, it looks like some of the calls to the wack_XXX
>> functions are getting optimized out by the compiler, even though no
>> optimization flags are being passed.
> Make the function non-static and it should work as expected...
Good call. Here's a patch, which cures my GCC 3.x problems (though
the two GCC 2.95 failures remain; I have no idea if they're our fault
or GCC's). Is it okay to commit?
David Carlton
carlton@math.stanford.edu
2002-12-05 David Carlton <carlton@math.stanford.edu>
* gdb.base/store.c: Don't declare functions static.
Index: store.c
===================================================================
RCS file: /cvs/src/src/gdb/testsuite/gdb.base/store.c,v
retrieving revision 1.1
diff -u -p -r1.1 store.c
--- store.c 5 Dec 2002 01:48:19 -0000 1.1
+++ store.c 5 Dec 2002 21:48:24 -0000
@@ -2,37 +2,42 @@
in the target. This pretty much relies on the compiler taking heed
of requests for values to be stored in registers. */
-static char
+/* NOTE: carlton/2002-12-05: These functions were all static, but for
+ whatever reason that caused GCC 3.1 to optimize away some of the
+ function calls within main even when no optimization flags were
+ passed. */
+
+char
add_char (register char u, register char v)
{
return u + v;
}
-static short
+short
add_short (register short u, register short v)
{
return u + v;
}
-static int
+int
add_int (register int u, register int v)
{
return u + v;
}
-static long
+long
add_long (register long u, register long v)
{
return u + v;
}
-static float
+float
add_float (register float u, register float v)
{
return u + v;
}
-static double
+double
add_double (register double u, register double v)
{
return u + v;
@@ -40,7 +45,7 @@ add_double (register double u, register
/* */
-static char
+char
wack_char (register char u, register char v)
{
register char l = u;
@@ -48,7 +53,7 @@ wack_char (register char u, register cha
return l;
}
-static short
+short
wack_short (register short u, register short v)
{
register short l = u;
@@ -56,7 +61,7 @@ wack_short (register short u, register s
return l;
}
-static int
+int
wack_int (register int u, register int v)
{
register int l = u;
@@ -64,7 +69,7 @@ wack_int (register int u, register int v
return l;
}
-static long
+long
wack_long (register long u, register long v)
{
register long l = u;
@@ -72,7 +77,7 @@ wack_long (register long u, register lon
return l;
}
-static float
+float
wack_float (register float u, register float v)
{
register float l = u;
@@ -80,7 +85,7 @@ wack_float (register float u, register f
return l;
}
-static double
+double
wack_double (register double u, register double v)
{
register double l = u;
@@ -93,7 +98,7 @@ struct s_2 { short s[2]; } z_2, s_2;
struct s_3 { short s[3]; } z_3, s_3;
struct s_4 { short s[4]; } z_4, s_4;
-static struct s_1
+struct s_1
add_struct_1 (struct s_1 s)
{
int i;
@@ -104,7 +109,7 @@ add_struct_1 (struct s_1 s)
return s;
}
-static struct s_2
+struct s_2
add_struct_2 (struct s_2 s)
{
int i;
@@ -115,7 +120,7 @@ add_struct_2 (struct s_2 s)
return s;
}
-static struct s_3
+struct s_3
add_struct_3 (struct s_3 s)
{
int i;
@@ -126,7 +131,7 @@ add_struct_3 (struct s_3 s)
return s;
}
-static struct s_4
+struct s_4
add_struct_4 (struct s_4 s)
{
int i;
@@ -137,7 +142,7 @@ add_struct_4 (struct s_4 s)
return s;
}
-static struct s_1
+struct s_1
wack_struct_1 (void)
{
int i; register struct s_1 u = z_1;
@@ -146,7 +151,7 @@ wack_struct_1 (void)
return u;
}
-static struct s_2
+struct s_2
wack_struct_2 (void)
{
int i; register struct s_2 u = z_2;
@@ -155,7 +160,7 @@ wack_struct_2 (void)
return u;
}
-static struct s_3
+struct s_3
wack_struct_3 (void)
{
int i; register struct s_3 u = z_3;
@@ -164,7 +169,7 @@ wack_struct_3 (void)
return u;
}
-static struct s_4
+struct s_4
wack_struct_4 (void)
{
int i; register struct s_4 u = z_4;
@@ -180,28 +185,28 @@ struct f_2 {unsigned i:2;unsigned j:2;un
struct f_3 {unsigned i:3;unsigned j:3;unsigned k:3; } f_3 = {1,1,1}, F_3;
struct f_4 {unsigned i:4;unsigned j:4;unsigned k:4; } f_4 = {1,1,1}, F_4;
-static struct f_1
+struct f_1
wack_field_1 (void)
{
register struct f_1 u = f_1;
return u;
}
-static struct f_2
+struct f_2
wack_field_2 (void)
{
register struct f_2 u = f_2;
return u;
}
-static struct f_3
+struct f_3
wack_field_3 (void)
{
register struct f_3 u = f_3;
return u;
}
-static struct f_4
+struct f_4
wack_field_4 (void)
{
register struct f_4 u = f_4;
^ permalink raw reply [flat|nested] 8+ messages in thread* Re: [rfa] store.exp failures
2002-12-05 15:32 [rfa] store.exp failures David Carlton
@ 2002-12-05 16:19 ` Fernando Nasser
2002-12-06 11:37 ` David Carlton
0 siblings, 1 reply; 8+ messages in thread
From: Fernando Nasser @ 2002-12-05 16:19 UTC (permalink / raw)
To: David Carlton; +Cc: gdb-patches, Daniel Jacobowitz, Andrew Cagney
David Carlton wrote:> Whoops, I should have sent this to gdb-patches instead of gdb.
>
> On Thu, 5 Dec 2002 16:42:51 -0500, Daniel Jacobowitz <drow@mvista.com> said:
>
>>On Thu, Dec 05, 2002 at 01:30:54PM -0800, David Carlton wrote:
>
>
>>>So, basically, it looks like some of the calls to the wack_XXX
>>>functions are getting optimized out by the compiler, even though no
>>>optimization flags are being passed.
>>
>
>>Make the function non-static and it should work as expected...
>
>
> Good call. Here's a patch, which cures my GCC 3.x problems (though
> the two GCC 2.95 failures remain; I have no idea if they're our fault
> or GCC's). Is it okay to commit?
>
I don't think not being static affects the goal of test at all, so if it fixes
the problem I have no objection.
Fernando
> David Carlton
> carlton@math.stanford.edu
>
> 2002-12-05 David Carlton <carlton@math.stanford.edu>
>
> * gdb.base/store.c: Don't declare functions static.
>
> Index: store.c
> ===================================================================
> RCS file: /cvs/src/src/gdb/testsuite/gdb.base/store.c,v
> retrieving revision 1.1
> diff -u -p -r1.1 store.c
> --- store.c 5 Dec 2002 01:48:19 -0000 1.1
> +++ store.c 5 Dec 2002 21:48:24 -0000
> @@ -2,37 +2,42 @@
> in the target. This pretty much relies on the compiler taking heed
> of requests for values to be stored in registers. */
>
> -static char
> +/* NOTE: carlton/2002-12-05: These functions were all static, but for
> + whatever reason that caused GCC 3.1 to optimize away some of the
> + function calls within main even when no optimization flags were
> + passed. */
> +
> +char
> add_char (register char u, register char v)
> {
> return u + v;
> }
>
> -static short
> +short
> add_short (register short u, register short v)
> {
> return u + v;
> }
>
> -static int
> +int
> add_int (register int u, register int v)
> {
> return u + v;
> }
>
> -static long
> +long
> add_long (register long u, register long v)
> {
> return u + v;
> }
>
> -static float
> +float
> add_float (register float u, register float v)
> {
> return u + v;
> }
>
> -static double
> +double
> add_double (register double u, register double v)
> {
> return u + v;
> @@ -40,7 +45,7 @@ add_double (register double u, register
>
> /* */
>
> -static char
> +char
> wack_char (register char u, register char v)
> {
> register char l = u;
> @@ -48,7 +53,7 @@ wack_char (register char u, register cha
> return l;
> }
>
> -static short
> +short
> wack_short (register short u, register short v)
> {
> register short l = u;
> @@ -56,7 +61,7 @@ wack_short (register short u, register s
> return l;
> }
>
> -static int
> +int
> wack_int (register int u, register int v)
> {
> register int l = u;
> @@ -64,7 +69,7 @@ wack_int (register int u, register int v
> return l;
> }
>
> -static long
> +long
> wack_long (register long u, register long v)
> {
> register long l = u;
> @@ -72,7 +77,7 @@ wack_long (register long u, register lon
> return l;
> }
>
> -static float
> +float
> wack_float (register float u, register float v)
> {
> register float l = u;
> @@ -80,7 +85,7 @@ wack_float (register float u, register f
> return l;
> }
>
> -static double
> +double
> wack_double (register double u, register double v)
> {
> register double l = u;
> @@ -93,7 +98,7 @@ struct s_2 { short s[2]; } z_2, s_2;
> struct s_3 { short s[3]; } z_3, s_3;
> struct s_4 { short s[4]; } z_4, s_4;
>
> -static struct s_1
> +struct s_1
> add_struct_1 (struct s_1 s)
> {
> int i;
> @@ -104,7 +109,7 @@ add_struct_1 (struct s_1 s)
> return s;
> }
>
> -static struct s_2
> +struct s_2
> add_struct_2 (struct s_2 s)
> {
> int i;
> @@ -115,7 +120,7 @@ add_struct_2 (struct s_2 s)
> return s;
> }
>
> -static struct s_3
> +struct s_3
> add_struct_3 (struct s_3 s)
> {
> int i;
> @@ -126,7 +131,7 @@ add_struct_3 (struct s_3 s)
> return s;
> }
>
> -static struct s_4
> +struct s_4
> add_struct_4 (struct s_4 s)
> {
> int i;
> @@ -137,7 +142,7 @@ add_struct_4 (struct s_4 s)
> return s;
> }
>
> -static struct s_1
> +struct s_1
> wack_struct_1 (void)
> {
> int i; register struct s_1 u = z_1;
> @@ -146,7 +151,7 @@ wack_struct_1 (void)
> return u;
> }
>
> -static struct s_2
> +struct s_2
> wack_struct_2 (void)
> {
> int i; register struct s_2 u = z_2;
> @@ -155,7 +160,7 @@ wack_struct_2 (void)
> return u;
> }
>
> -static struct s_3
> +struct s_3
> wack_struct_3 (void)
> {
> int i; register struct s_3 u = z_3;
> @@ -164,7 +169,7 @@ wack_struct_3 (void)
> return u;
> }
>
> -static struct s_4
> +struct s_4
> wack_struct_4 (void)
> {
> int i; register struct s_4 u = z_4;
> @@ -180,28 +185,28 @@ struct f_2 {unsigned i:2;unsigned j:2;un
> struct f_3 {unsigned i:3;unsigned j:3;unsigned k:3; } f_3 = {1,1,1}, F_3;
> struct f_4 {unsigned i:4;unsigned j:4;unsigned k:4; } f_4 = {1,1,1}, F_4;
>
> -static struct f_1
> +struct f_1
> wack_field_1 (void)
> {
> register struct f_1 u = f_1;
> return u;
> }
>
> -static struct f_2
> +struct f_2
> wack_field_2 (void)
> {
> register struct f_2 u = f_2;
> return u;
> }
>
> -static struct f_3
> +struct f_3
> wack_field_3 (void)
> {
> register struct f_3 u = f_3;
> return u;
> }
>
> -static struct f_4
> +struct f_4
> wack_field_4 (void)
> {
> register struct f_4 u = f_4;
>
--
Fernando Nasser
Red Hat - Toronto E-Mail: fnasser@redhat.com
2323 Yonge Street, Suite #300
Toronto, Ontario M4P 2C9
^ permalink raw reply [flat|nested] 8+ messages in thread* Re: [rfa] store.exp failures
2002-12-05 16:19 ` Fernando Nasser
@ 2002-12-06 11:37 ` David Carlton
2002-12-06 11:58 ` Andrew Cagney
0 siblings, 1 reply; 8+ messages in thread
From: David Carlton @ 2002-12-06 11:37 UTC (permalink / raw)
To: Fernando Nasser; +Cc: gdb-patches, Daniel Jacobowitz, Andrew Cagney
On Thu, 05 Dec 2002 19:16:54 -0500, Fernando Nasser <fnasser@redhat.com> said:
> I don't think not being static affects the goal of test at all, so if
> it fixes the problem I have no objection.
Thanks, I've committed it.
David Carlton
carlton@math.stanford.edu
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [rfa] store.exp failures
2002-12-06 11:37 ` David Carlton
@ 2002-12-06 11:58 ` Andrew Cagney
2002-12-06 12:15 ` David Carlton
0 siblings, 1 reply; 8+ messages in thread
From: Andrew Cagney @ 2002-12-06 11:58 UTC (permalink / raw)
To: David Carlton; +Cc: Fernando Nasser, gdb-patches, Daniel Jacobowitz
> On Thu, 05 Dec 2002 19:16:54 -0500, Fernando Nasser <fnasser@redhat.com> said:
>
>
>> I don't think not being static affects the goal of test at all, so if
>> it fixes the problem I have no objection.
>
>
> Thanks, I've committed it.
Thanks. In case you're wondering, yes it does pass but with older
compilers. Now we get to see what bugs it flushes out ...
I'm also wondering of GCC eliminating functions when -O0 is a bug.
Andrew
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [rfa] store.exp failures
2002-12-06 11:58 ` Andrew Cagney
@ 2002-12-06 12:15 ` David Carlton
2002-12-06 14:08 ` Andrew Cagney
2002-12-06 15:54 ` Andrew Cagney
0 siblings, 2 replies; 8+ messages in thread
From: David Carlton @ 2002-12-06 12:15 UTC (permalink / raw)
To: Andrew Cagney; +Cc: Fernando Nasser, gdb-patches, Daniel Jacobowitz
On Fri, 06 Dec 2002 14:37:32 -0500, Andrew Cagney <ac131313@redhat.com> said:
> Thanks. In case you're wondering, yes it does pass but with older
> compilers.
Do you see the two failures with GCC 2.95.3 that I see, by the way?
They're
FAIL: gdb.base/store.exp: new up struct 1
FAIL: gdb.base/store.exp: new up struct 2
I don't know if they're our fault or GCC's fault. (Or even nobody's
fault: the test seems a bit delicate.)
> I'm also wondering of GCC eliminating functions when -O0 is a bug.
Yeah, I wondered about that, too: it's not going to make our lives any
easier if GCC continues doing this...
David Carlton
carlton@math.stanford.edu
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [rfa] store.exp failures
2002-12-06 12:15 ` David Carlton
@ 2002-12-06 14:08 ` Andrew Cagney
2002-12-06 19:32 ` David Carlton
2002-12-06 15:54 ` Andrew Cagney
1 sibling, 1 reply; 8+ messages in thread
From: Andrew Cagney @ 2002-12-06 14:08 UTC (permalink / raw)
To: David Carlton; +Cc: Fernando Nasser, gdb-patches, Daniel Jacobowitz
> On Fri, 06 Dec 2002 14:37:32 -0500, Andrew Cagney <ac131313@redhat.com> said:
>
>
>> Thanks. In case you're wondering, yes it does pass but with older
>> compilers.
>
>
> Do you see the two failures with GCC 2.95.3 that I see, by the way?
> They're
>
> FAIL: gdb.base/store.exp: new up struct 1
> FAIL: gdb.base/store.exp: new up struct 2
>
> I don't know if they're our fault or GCC's fault. (Or even nobody's
> fault: the test seems a bit delicate.)
On a powerpc:
Running /home/scratch/GDB/src/gdb/testsuite/gdb.base/store.exp ...
=== gdb Summary ===
# of expected passes 204
ac131313@nettle$ gcc --version
2.95.3
And on a Red Hat 7,2 system:
Running /home/cagney/GDB/src/gdb/testsuite/gdb.base/store.exp ...
=== gdb Summary ===
# of expected passes 204
cagney@torrens$ gcc --version
2.96
>> I'm also wondering of GCC eliminating functions when -O0 is a bug.
>
>
> Yeah, I wondered about that, too: it's not going to make our lives any
> easier if GCC continues doing this...
Asked a GCC engineer. They agreed, at -O0, it shouldn't be eliminating
static functions.
Andrew
^ permalink raw reply [flat|nested] 8+ messages in thread* Re: [rfa] store.exp failures
2002-12-06 14:08 ` Andrew Cagney
@ 2002-12-06 19:32 ` David Carlton
0 siblings, 0 replies; 8+ messages in thread
From: David Carlton @ 2002-12-06 19:32 UTC (permalink / raw)
To: Andrew Cagney; +Cc: Fernando Nasser, gdb-patches, Daniel Jacobowitz
On Fri, 06 Dec 2002 16:55:34 -0500, Andrew Cagney <ac131313@redhat.com> said:
> On a powerpc:
> Running /home/scratch/GDB/src/gdb/testsuite/gdb.base/store.exp ...
> === gdb Summary ===
> # of expected passes 204
> ac131313@nettle$ gcc --version
> 2.95.3
> And on a Red Hat 7,2 system:
> Running /home/cagney/GDB/src/gdb/testsuite/gdb.base/store.exp ...
> === gdb Summary ===
> # of expected passes 204
> cagney@torrens$ gcc --version
> 2.96
Yeah, 2.96 passes for me, too. Who knows what's going on with
i686-gnu-linux 2.95.3, then.
> BTW, what makes you think the test is delicate? The code is valid C
> and the command:
> (gdb) set variable u = s_1
> is valid in GDB's CLI. If it doesn't work, its a bug.
Actually, I was misinterpreting the following comment at the top of
store.c:
/* Check that GDB can correctly update a value, living in a register,
in the target. This pretty much relies on the compiler taking heed
of requests for values to be stored in registers. */
But I suppose that, even if the compiler doesn't pay attention to
'register' requests, the tests should stil work fine, they just won't
test what they're supposed to. So 'delicate' is definitely the wrong
word.
David Carlton
carlton@math.stanford.edu
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [rfa] store.exp failures
2002-12-06 12:15 ` David Carlton
2002-12-06 14:08 ` Andrew Cagney
@ 2002-12-06 15:54 ` Andrew Cagney
1 sibling, 0 replies; 8+ messages in thread
From: Andrew Cagney @ 2002-12-06 15:54 UTC (permalink / raw)
To: David Carlton; +Cc: Fernando Nasser, gdb-patches, Daniel Jacobowitz
> On Fri, 06 Dec 2002 14:37:32 -0500, Andrew Cagney <ac131313@redhat.com> said:
>
>
>> Thanks. In case you're wondering, yes it does pass but with older
>> compilers.
>
>
> Do you see the two failures with GCC 2.95.3 that I see, by the way?
> They're
>
> FAIL: gdb.base/store.exp: new up struct 1
> FAIL: gdb.base/store.exp: new up struct 2
>
> I don't know if they're our fault or GCC's fault. (Or even nobody's
> fault: the test seems a bit delicate.)
BTW, what makes you think the test is delicate? The code is valid C and
the command:
(gdb) set variable u = s_1
is valid in GDB's CLI. If it doesn't work, its a bug.
Andrew
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2002-12-07 1:33 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-12-05 15:32 [rfa] store.exp failures David Carlton
2002-12-05 16:19 ` Fernando Nasser
2002-12-06 11:37 ` David Carlton
2002-12-06 11:58 ` Andrew Cagney
2002-12-06 12:15 ` David Carlton
2002-12-06 14:08 ` Andrew Cagney
2002-12-06 19:32 ` David Carlton
2002-12-06 15:54 ` Andrew Cagney
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox