public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug regression/16088] New: Generates invalid code
@ 2004-06-19 15:58 lucier at math dot purdue dot edu
2004-06-20 16:44 ` [Bug rtl-optimization/16088] " pinskia at gcc dot gnu dot org
` (9 more replies)
0 siblings, 10 replies; 11+ messages in thread
From: lucier at math dot purdue dot edu @ 2004-06-19 15:58 UTC (permalink / raw)
To: gcc-bugs
This one's a mystery. Here are the versions of gcc and of gdb. First, can I
trust what this gdb reports for this code?
[xsun21:~/programs/gambc40b4-devel] lucier% /pkgs/gcc-mainline/bin/gcc -v
Reading specs from /pkgs/gcc-mainline/lib/gcc/powerpc-apple-darwin7.4.0/3.5.0/specs
Configured with: ../configure --prefix=/pkgs/gcc-mainline
Thread model: posix
gcc version 3.5.0 20040617 (experimental)
[xsun21:~/programs/gambc40b4-devel] lucier% gdb -v
GNU gdb 5.3-20030128 (Apple version gdb-309) (Thu Dec 4 15:41:30 GMT 2003)
Copyright 2003 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB. Type "show warranty" for details.
This GDB was configured as "powerpc-apple-darwin".
The input files are
http://www.math.purdue.edu/~lucier/GNATS/GNATS-10
The command line is
gcc -I../include -I. -no-cpp-precomp -Wall -W -Wno-unused -O1 -fno-math-errno
-fschedule-insns2 -fno-trapping-math -fno-strict-aliasing -fomit-frame-pointer
-fPIC -fno-common -g -save-temps -DHAVE_CONFIG_H -D___PRIMAL -D___LIBRARY
-D___GAMBCDIR=\"/usr/local/\" -c _nonstd.c
Here are the steps up to the invalid memory access, displaying ___fp at each step:
15546 ___SET_R4(___STRINGLENGTH(___R2))
1: ___fp = (<invalid type code 7> *) 0x60106d
(gdb) s
15547 ___IF(___NOT(___FIXLT(___FIX(0L),___R4)))
1: ___fp = (<invalid type code 7> *) 0x60106d
(gdb) s
15550 ___SET_STK(1,___FIXSUB(___R4,___FIX(1L)))
1: ___fp = (<invalid type code 7> *) 0x60106d
(gdb) s
15552 ___SET_STK(1,___BOOLEAN(___CHAREQP(___STK(-1),___STK(1))))
1: ___fp = (<invalid type code 7> *) 0x60106d
(gdb) s
15551 ___SET_STK(1,___STRINGREF(___R2,___STK(1)))
1: ___fp = (<invalid type code 7> *) 0x60106d
(gdb) s
15550 ___SET_STK(1,___FIXSUB(___R4,___FIX(1L)))
1: ___fp = (<invalid type code 7> *) 0x60106d
(gdb) s
15551 ___SET_STK(1,___STRINGREF(___R2,___STK(1)))
1: ___fp = (<invalid type code 7> *) 0x60106d
(gdb) s
15552 ___SET_STK(1,___BOOLEAN(___CHAREQP(___STK(-1),___STK(1))))
1: ___fp = (<invalid type code 7> *) 0x2f
(gdb) s
15551 ___SET_STK(1,___STRINGREF(___R2,___STK(1)))
1: ___fp = (<invalid type code 7> *) 0x2f
(gdb) s
15552 ___SET_STK(1,___BOOLEAN(___CHAREQP(___STK(-1),___STK(1))))
1: ___fp = (<invalid type code 7> *) 0xbe
(gdb) s
15557 ___IF(___FALSEP(___R1))
1: ___fp = (<invalid type code 7> *) 0xfffffffa
(gdb) s
15552 ___SET_STK(1,___BOOLEAN(___CHAREQP(___STK(-1),___STK(1))))
1: ___fp = (<invalid type code 7> *) 0xfffffffa
(gdb)
15553 ___SET_STK(2,___R1)
1: ___fp = (<invalid type code 7> *) 0xfffffffa
(gdb) s
15555 ___SET_STK(1,___STK(2))
1: ___fp = (<invalid type code 7> *) 0xfffffffa
(gdb)
15557 ___IF(___FALSEP(___R1))
1: ___fp = (<invalid type code 7> *) 0xfffffffa
(gdb)
15572 ___SET_R4(___FIXSUB(___R4,___R3))
1: ___fp = (<invalid type code 7> *) 0xfffffffa
(gdb)
Program received signal EXC_BAD_ACCESS, Could not access memory.
0x0009cc2c in ___H__20___nonstd (___ps=0x1e31f8) at _nonstd.c:15572
15572 ___SET_R4(___FIXSUB(___R4,___R3))
1: ___fp = (<invalid type code 7> *) 0x28
The assembly is
.stabd 68,0,15546
lwz r0,-1(r25)
.stabd 68,0,15547
rlwinm. r10,r0,25,7,29
ble- cr0,L4572
.stabd 68,0,15550
addi r11,r10,-4
.stabd 68,0,15552
lwz r0,4(r30)
.stabd 68,0,15551
srawi r9,r11,1
.stabd 68,0,15550
stw r11,-4(r30)
.stabd 68,0,15551
add r9,r9,r25
lhz r2,3(r9)
.stabd 68,0,15552
mr r9,r30
.stabd 68,0,15551
slwi r2,r2,2
addi r2,r2,2
stw r2,-4(r30)
.stabd 68,0,15552
xor r2,r2,r0
addic r2,r2,-1
subfe r2,r2,r2
rlwinm r2,r2,0,0,29
addi r2,r2,-2
.stabd 68,0,15557
cmpwi cr7,r2,-2
.stabd 68,0,15552
stwu r2,-4(r9)
.stabd 68,0,15553
stw r11,-8(r30)
.stabd 68,0,15555
stw r11,0(r9)
.stabd 68,0,15557
bne+ cr7,L4578
b L4577
L4572:
.stabd 68,0,15562
stwu r28,-4(r30)
.stabd 68,0,15564
mr r11,r10
mr r9,r30
b L4578
L4577:
.stabd 68,0,15568
mr r11,r10
L4578:
.stabd 68,0,15572
lwz r2,0(r9)
The invalid access is occuring at the source line
___r4=((((int)(((((unsigned int)((*((int*)((___fp[-(0)])-(1))))))>>(3
+5))>>1)))<<2));
which is why I traced the value of ___fp.
It seems that ___fp has a rational value until line 15552, then all hell breaks
loose (if I can believe gdb).
And I haven't been able to find a smaller example, sorry.
This works with all previous versions of gcc.
Brad
--
Summary: Generates invalid code
Product: gcc
Version: 3.5.0
Status: UNCONFIRMED
Severity: normal
Priority: P2
Component: regression
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: lucier at math dot purdue dot edu
CC: gcc-bugs at gcc dot gnu dot org
GCC build triplet: powerpc-apple-darwin7.4.0
GCC host triplet: powerpc-apple-darwin7.4.0
GCC target triplet: powerpc-apple-darwin7.4.0
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=16088
^ permalink raw reply [flat|nested] 11+ messages in thread
* [Bug rtl-optimization/16088] Generates invalid code
2004-06-19 15:58 [Bug regression/16088] New: Generates invalid code lucier at math dot purdue dot edu
@ 2004-06-20 16:44 ` pinskia at gcc dot gnu dot org
2004-08-03 23:39 ` [Bug rtl-optimization/16088] [3.5 Regression] " pinskia at gcc dot gnu dot org
` (8 subsequent siblings)
9 siblings, 0 replies; 11+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-06-20 16:44 UTC (permalink / raw)
To: gcc-bugs
--
What |Removed |Added
----------------------------------------------------------------------------
Component|regression |rtl-optimization
Keywords| |wrong-code
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=16088
^ permalink raw reply [flat|nested] 11+ messages in thread
* [Bug rtl-optimization/16088] [3.5 Regression] Generates invalid code
2004-06-19 15:58 [Bug regression/16088] New: Generates invalid code lucier at math dot purdue dot edu
2004-06-20 16:44 ` [Bug rtl-optimization/16088] " pinskia at gcc dot gnu dot org
@ 2004-08-03 23:39 ` pinskia at gcc dot gnu dot org
2004-09-15 3:59 ` [Bug rtl-optimization/16088] [4.0 " pinskia at gcc dot gnu dot org
` (7 subsequent siblings)
9 siblings, 0 replies; 11+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-08-03 23:39 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From pinskia at gcc dot gnu dot org 2004-08-03 23:39 -------
Note the debuging problem for "invalid type" is filed under PR 14860.
--
What |Removed |Added
----------------------------------------------------------------------------
Summary|Generates invalid code |[3.5 Regression] Generates
| |invalid code
Target Milestone|--- |3.5.0
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=16088
^ permalink raw reply [flat|nested] 11+ messages in thread
* [Bug rtl-optimization/16088] [4.0 Regression] Generates invalid code
2004-06-19 15:58 [Bug regression/16088] New: Generates invalid code lucier at math dot purdue dot edu
2004-06-20 16:44 ` [Bug rtl-optimization/16088] " pinskia at gcc dot gnu dot org
2004-08-03 23:39 ` [Bug rtl-optimization/16088] [3.5 Regression] " pinskia at gcc dot gnu dot org
@ 2004-09-15 3:59 ` pinskia at gcc dot gnu dot org
2004-09-15 14:01 ` lucier at math dot purdue dot edu
` (6 subsequent siblings)
9 siblings, 0 replies; 11+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-09-15 3:59 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From pinskia at gcc dot gnu dot org 2004-09-15 03:59 -------
Does this work now?
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=16088
^ permalink raw reply [flat|nested] 11+ messages in thread
* [Bug rtl-optimization/16088] [4.0 Regression] Generates invalid code
2004-06-19 15:58 [Bug regression/16088] New: Generates invalid code lucier at math dot purdue dot edu
` (2 preceding siblings ...)
2004-09-15 3:59 ` [Bug rtl-optimization/16088] [4.0 " pinskia at gcc dot gnu dot org
@ 2004-09-15 14:01 ` lucier at math dot purdue dot edu
2004-09-30 13:22 ` [Bug rtl-optimization/16088] [4.0 Regression] Generates wrong code pinskia at gcc dot gnu dot org
` (5 subsequent siblings)
9 siblings, 0 replies; 11+ messages in thread
From: lucier at math dot purdue dot edu @ 2004-09-15 14:01 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From lucier at math dot purdue dot edu 2004-09-15 14:00 -------
Subject: Re: [4.0 Regression] Generates invalid code
> Does this work now?
Does it fail at the same spot? No.
Does it fail in a similar way at a different spot? Yes.
This is with
[descartes:~/programs/gambc40b4-devel] lucier% gcc -v
Reading specs from
/pkgs/gcc-mainline/lib/gcc/powerpc-apple-darwin7.5.0/4.0.0/specs
Configured with: ../configure --prefix=/pkgs/gcc-mainline
--with-gmp=/pkgs/gmp-4.1.3 --with-mpfr=/pkgs/gmp-4.1.3
Thread model: posix
gcc version 4.0.0 20040913 (experimental)
Should I file a new PR?
And, can I trust what information gdb gives me when tracing codes
compiled with this version of gcc on powerpc-apple-darwin7.5.0?
Brad
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=16088
^ permalink raw reply [flat|nested] 11+ messages in thread
* [Bug rtl-optimization/16088] [4.0 Regression] Generates wrong code
2004-06-19 15:58 [Bug regression/16088] New: Generates invalid code lucier at math dot purdue dot edu
` (3 preceding siblings ...)
2004-09-15 14:01 ` lucier at math dot purdue dot edu
@ 2004-09-30 13:22 ` pinskia at gcc dot gnu dot org
2004-10-27 23:53 ` geoffk at gcc dot gnu dot org
` (4 subsequent siblings)
9 siblings, 0 replies; 11+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-09-30 13:22 UTC (permalink / raw)
To: gcc-bugs
--
What |Removed |Added
----------------------------------------------------------------------------
Summary|[4.0 Regression] Generates |[4.0 Regression] Generates
|invalid code |wrong code
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=16088
^ permalink raw reply [flat|nested] 11+ messages in thread
* [Bug rtl-optimization/16088] [4.0 Regression] Generates wrong code
2004-06-19 15:58 [Bug regression/16088] New: Generates invalid code lucier at math dot purdue dot edu
` (4 preceding siblings ...)
2004-09-30 13:22 ` [Bug rtl-optimization/16088] [4.0 Regression] Generates wrong code pinskia at gcc dot gnu dot org
@ 2004-10-27 23:53 ` geoffk at gcc dot gnu dot org
2004-10-29 13:19 ` pinskia at gcc dot gnu dot org
` (3 subsequent siblings)
9 siblings, 0 replies; 11+ messages in thread
From: geoffk at gcc dot gnu dot org @ 2004-10-27 23:53 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From geoffk at gcc dot gnu dot org 2004-10-27 23:53 -------
No, I don't think you can trust the values of variables in gdb when using stabs (like on Darwin) at
optimisation levels higher than -O0.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=16088
^ permalink raw reply [flat|nested] 11+ messages in thread
* [Bug rtl-optimization/16088] [4.0 Regression] Generates wrong code
2004-06-19 15:58 [Bug regression/16088] New: Generates invalid code lucier at math dot purdue dot edu
` (5 preceding siblings ...)
2004-10-27 23:53 ` geoffk at gcc dot gnu dot org
@ 2004-10-29 13:19 ` pinskia at gcc dot gnu dot org
2004-11-04 3:31 ` lucier at math dot purdue dot edu
` (2 subsequent siblings)
9 siblings, 0 replies; 11+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-10-29 13:19 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From pinskia at gcc dot gnu dot org 2004-10-29 13:19 -------
Can you try again, there was recently patch which might help, also can you attach a preprocessed
source which you can link?
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=16088
^ permalink raw reply [flat|nested] 11+ messages in thread
* [Bug rtl-optimization/16088] [4.0 Regression] Generates wrong code
2004-06-19 15:58 [Bug regression/16088] New: Generates invalid code lucier at math dot purdue dot edu
` (6 preceding siblings ...)
2004-10-29 13:19 ` pinskia at gcc dot gnu dot org
@ 2004-11-04 3:31 ` lucier at math dot purdue dot edu
2004-11-18 1:13 ` lucier at math dot purdue dot edu
2004-11-18 1:26 ` giovannibajo at libero dot it
9 siblings, 0 replies; 11+ messages in thread
From: lucier at math dot purdue dot edu @ 2004-11-04 3:31 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From lucier at math dot purdue dot edu 2004-11-04 03:31 -------
Subject: Re: [4.0 Regression] Generates wrong code
I tried again, I'm having the same problems with today's 4.0.
I also have the same problems on sparc-sun-solaris2.9. I tried
debugging it with gdb 6.2.1 on that platform but got garbage
information about variables, etc. Geoff says I can't trust gdb on
powerpc-apple-darwin7.5.0, either, with -O1.
Is there any gdb on any OS platform that I can use to debug this
problem? Should I try it on a friend's x86 Linux box? Or should I
proceed in a different way.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=16088
^ permalink raw reply [flat|nested] 11+ messages in thread
* [Bug rtl-optimization/16088] [4.0 Regression] Generates wrong code
2004-06-19 15:58 [Bug regression/16088] New: Generates invalid code lucier at math dot purdue dot edu
` (7 preceding siblings ...)
2004-11-04 3:31 ` lucier at math dot purdue dot edu
@ 2004-11-18 1:13 ` lucier at math dot purdue dot edu
2004-11-18 1:26 ` giovannibajo at libero dot it
9 siblings, 0 replies; 11+ messages in thread
From: lucier at math dot purdue dot edu @ 2004-11-18 1:13 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From lucier at math dot purdue dot edu 2004-11-18 01:13 -------
Maybe this bug should be closed for lack of specificity.
The problem is the following: gcc-4.0 miscompiles C code generated by the
Scheme->C compiler Gambit-C (http://www.iro.umontreal.ca/~gambit). I have not
been able to debug the problem (all the various version of gdb I tried have not
been helpful). In the meantime, two code generation bugs have been fixed (one
in the past few days), and several still remain.
So the specific information (such as it is) in this bug report is no longer
accurate. It is still a fact that gcc-4.0 miscompiles code generated by
Gambit-C (and examples of this are easy to find, e.g., the compiler itself
aborts in many cases)---perhaps this should be a placeholder bug report for this
general problem? I don't know.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=16088
^ permalink raw reply [flat|nested] 11+ messages in thread
* [Bug rtl-optimization/16088] [4.0 Regression] Generates wrong code
2004-06-19 15:58 [Bug regression/16088] New: Generates invalid code lucier at math dot purdue dot edu
` (8 preceding siblings ...)
2004-11-18 1:13 ` lucier at math dot purdue dot edu
@ 2004-11-18 1:26 ` giovannibajo at libero dot it
9 siblings, 0 replies; 11+ messages in thread
From: giovannibajo at libero dot it @ 2004-11-18 1:26 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From giovannibajo at libero dot it 2004-11-18 01:26 -------
OK closing this as invalid then. It would be great if you could reduce it to
something attachable. A big preprocessed source code which segfaults is already
a starting point, for instance.
--
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |RESOLVED
Resolution| |INVALID
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=16088
^ permalink raw reply [flat|nested] 11+ messages in thread
end of thread, other threads:[~2004-11-18 1:26 UTC | newest]
Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-06-19 15:58 [Bug regression/16088] New: Generates invalid code lucier at math dot purdue dot edu
2004-06-20 16:44 ` [Bug rtl-optimization/16088] " pinskia at gcc dot gnu dot org
2004-08-03 23:39 ` [Bug rtl-optimization/16088] [3.5 Regression] " pinskia at gcc dot gnu dot org
2004-09-15 3:59 ` [Bug rtl-optimization/16088] [4.0 " pinskia at gcc dot gnu dot org
2004-09-15 14:01 ` lucier at math dot purdue dot edu
2004-09-30 13:22 ` [Bug rtl-optimization/16088] [4.0 Regression] Generates wrong code pinskia at gcc dot gnu dot org
2004-10-27 23:53 ` geoffk at gcc dot gnu dot org
2004-10-29 13:19 ` pinskia at gcc dot gnu dot org
2004-11-04 3:31 ` lucier at math dot purdue dot edu
2004-11-18 1:13 ` lucier at math dot purdue dot edu
2004-11-18 1:26 ` giovannibajo at libero dot it
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).