public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug middle-end/20030] New: Broken arguments access
@ 2005-02-17 20:30 grigory dot zagorodnev at intel dot com
2005-02-17 21:21 ` [Bug middle-end/20030] " pinskia at gcc dot gnu dot org
` (10 more replies)
0 siblings, 11 replies; 12+ messages in thread
From: grigory dot zagorodnev at intel dot com @ 2005-02-17 20:30 UTC (permalink / raw)
To: gcc-bugs
Broken arguments access
Starting February 13th, gfrotran fails on the following test case on
ia32/ia64/x86_64 platforms with all kinds of optimizations: -O0, -O1, -O2 etc.
The issue is critical because it affects SPEC cpu2k tests wupwise and galgel on
all platforms.
$ cat foo.f
program foo
character*1 a1, a2, b
a1='A'
a2='A'
b='B'
x = LSAME(a1,a2)
if ( x.eq.1 ) then
write(*,*) 'passsed'
else
write(*,*) 'failed'
endif
end
logical function LSAME( CA, CB )
character CA, CB
integer INTA, INTB
INTA = ICHAR( CA )
INTB = ICHAR( CB )
write(*,*) INTA, INTB
LSAME = INTA.EQ.INTB
end
The reason of failure is the broken argument access for the function. Here is
the ia32 Linux code obtained with -O0 optimization.
.type lsame_, @function
lsame_:
pushl %ebp
movl %esp, %ebp
subl $16, %esp
movl 8(%ebp), %eax
movb -1(%eax), %al <-- Wrong. Must be "movb (%eax), %al"
movzbl %al, %eax
movl %eax, -8(%ebp)
movl 12(%ebp), %eax
movb -1(%eax), %al <-- Wrong. Must be "movb (%eax), %al"
movzbl %al, %eax
This issue has been discussed here http://gcc.gnu.org/ml/gcc/2005-
02/msg00685.html but not resolved yet and bug search gave me nothing. It
appears that breakage introduced by revision 2.110 (and later 2.112) of
gcc/gimplify.c. The exact place is:
$ cvs diff -r 2.111 -r 2.112
gcc/gimplify.c
3797a3799,3803
> case INDIRECT_REF:
> *expr_p = fold_indirect_ref (*expr_p);
> if (*expr_p != save_expr)
> break;
> /* else fall through. */
3800d3805
< case INDIRECT_REF:
--
Summary: Broken arguments access
Product: gcc
Version: 4.0.0
Status: UNCONFIRMED
Severity: normal
Priority: P2
Component: middle-end
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: grigory dot zagorodnev at intel dot com
CC: gcc-bugs at gcc dot gnu dot org
GCC host triplet: i686-redhat-linux
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=20030
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug middle-end/20030] Broken arguments access
2005-02-17 20:30 [Bug middle-end/20030] New: Broken arguments access grigory dot zagorodnev at intel dot com
@ 2005-02-17 21:21 ` pinskia at gcc dot gnu dot org
2005-02-17 21:26 ` pinskia at gcc dot gnu dot org
` (9 subsequent siblings)
10 siblings, 0 replies; 12+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-02-17 21:21 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From pinskia at gcc dot gnu dot org 2005-02-17 17:03 -------
I think this is a bug in fold_indirect_ref and not in the fortran front-end as Jason as has said, the front-
end provides a cast to char* and then dereferences the pointer.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=20030
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug middle-end/20030] Broken arguments access
2005-02-17 20:30 [Bug middle-end/20030] New: Broken arguments access grigory dot zagorodnev at intel dot com
2005-02-17 21:21 ` [Bug middle-end/20030] " pinskia at gcc dot gnu dot org
@ 2005-02-17 21:26 ` pinskia at gcc dot gnu dot org
2005-02-17 21:28 ` [Bug middle-end/20030] [4.0 Regression] " pinskia at gcc dot gnu dot org
` (8 subsequent siblings)
10 siblings, 0 replies; 12+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-02-17 21:26 UTC (permalink / raw)
To: gcc-bugs
--
What |Removed |Added
----------------------------------------------------------------------------
CC| |jason at gcc dot gnu dot org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=20030
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug middle-end/20030] [4.0 Regression] Broken arguments access
2005-02-17 20:30 [Bug middle-end/20030] New: Broken arguments access grigory dot zagorodnev at intel dot com
2005-02-17 21:21 ` [Bug middle-end/20030] " pinskia at gcc dot gnu dot org
2005-02-17 21:26 ` pinskia at gcc dot gnu dot org
@ 2005-02-17 21:28 ` pinskia at gcc dot gnu dot org
2005-02-17 21:36 ` pinskia at gcc dot gnu dot org
` (7 subsequent siblings)
10 siblings, 0 replies; 12+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-02-17 21:28 UTC (permalink / raw)
To: gcc-bugs
--
What |Removed |Added
----------------------------------------------------------------------------
CC| |pinskia at gcc dot gnu dot
| |org
Keywords| |wrong-code
Summary|Broken arguments access |[4.0 Regression] Broken
| |arguments access
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=20030
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug middle-end/20030] [4.0 Regression] Broken arguments access
2005-02-17 20:30 [Bug middle-end/20030] New: Broken arguments access grigory dot zagorodnev at intel dot com
` (2 preceding siblings ...)
2005-02-17 21:28 ` [Bug middle-end/20030] [4.0 Regression] " pinskia at gcc dot gnu dot org
@ 2005-02-17 21:36 ` pinskia at gcc dot gnu dot org
2005-02-17 21:41 ` pinskia at gcc dot gnu dot org
` (6 subsequent siblings)
10 siblings, 0 replies; 12+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-02-17 21:36 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From pinskia at gcc dot gnu dot org 2005-02-17 17:25 -------
This is a bug in fold_indirect_ref.
We get now:
D.485 = (*ca)[0]{lb: 1 sz: 1};
See how the lower bound is 1, that is wrong.
A related C testcase is:
typedef char a[1];
int f(a * b)
{
char a1 = *(char*)(b);
return a1;
}
But for C we don't have lower bounds. In fact in fortran we lower already all the array access so they
start at 0.
--
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |NEW
Ever Confirmed| |1
Last reconfirmed|0000-00-00 00:00:00 |2005-02-17 17:25:38
date| |
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=20030
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug middle-end/20030] [4.0 Regression] Broken arguments access
2005-02-17 20:30 [Bug middle-end/20030] New: Broken arguments access grigory dot zagorodnev at intel dot com
` (3 preceding siblings ...)
2005-02-17 21:36 ` pinskia at gcc dot gnu dot org
@ 2005-02-17 21:41 ` pinskia at gcc dot gnu dot org
2005-02-17 22:16 ` pinskia at gcc dot gnu dot org
` (5 subsequent siblings)
10 siblings, 0 replies; 12+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-02-17 21:41 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From pinskia at gcc dot gnu dot org 2005-02-17 17:40 -------
I have a fix which I am testing.
Yes this was a bug in fold_indirect_ref and not in the fortran front-end (it could also effect Ada too but I
have no test case for Ada).
Basically what happens is that the fortran front-end creates an array which has a lower bound of 1 and
then casts the reference to one of those to the pointer type of the type (of what is in the array) and the
dereferences it. fold_indirect_ref would get the lower bound wrong which causes us to create wrong
code.
--
What |Removed |Added
----------------------------------------------------------------------------
AssignedTo|unassigned at gcc dot gnu |pinskia at gcc dot gnu dot
|dot org |org
Status|NEW |ASSIGNED
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=20030
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug middle-end/20030] [4.0 Regression] Broken arguments access
2005-02-17 20:30 [Bug middle-end/20030] New: Broken arguments access grigory dot zagorodnev at intel dot com
` (4 preceding siblings ...)
2005-02-17 21:41 ` pinskia at gcc dot gnu dot org
@ 2005-02-17 22:16 ` pinskia at gcc dot gnu dot org
2005-02-17 22:39 ` tobi at gcc dot gnu dot org
` (4 subsequent siblings)
10 siblings, 0 replies; 12+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-02-17 22:16 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From pinskia at gcc dot gnu dot org 2005-02-17 17:45 -------
Patch here: <http://gcc.gnu.org/ml/gcc-patches/2005-02/msg01002.html>.
--
What |Removed |Added
----------------------------------------------------------------------------
Keywords| |patch
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=20030
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug middle-end/20030] [4.0 Regression] Broken arguments access
2005-02-17 20:30 [Bug middle-end/20030] New: Broken arguments access grigory dot zagorodnev at intel dot com
` (5 preceding siblings ...)
2005-02-17 22:16 ` pinskia at gcc dot gnu dot org
@ 2005-02-17 22:39 ` tobi at gcc dot gnu dot org
2005-02-17 23:16 ` sgk at troutmask dot apl dot washington dot edu
` (3 subsequent siblings)
10 siblings, 0 replies; 12+ messages in thread
From: tobi at gcc dot gnu dot org @ 2005-02-17 22:39 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From tobi at gcc dot gnu dot org 2005-02-17 18:12 -------
Adding Steve Kargl to CC, as this is most likely the BLAS bug he's been looking
into.
--
What |Removed |Added
----------------------------------------------------------------------------
CC| |sgk at troutmask dot apl dot
| |washington dot edu
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=20030
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug middle-end/20030] [4.0 Regression] Broken arguments access
2005-02-17 20:30 [Bug middle-end/20030] New: Broken arguments access grigory dot zagorodnev at intel dot com
` (6 preceding siblings ...)
2005-02-17 22:39 ` tobi at gcc dot gnu dot org
@ 2005-02-17 23:16 ` sgk at troutmask dot apl dot washington dot edu
2005-02-18 20:22 ` cvs-commit at gcc dot gnu dot org
` (2 subsequent siblings)
10 siblings, 0 replies; 12+ messages in thread
From: sgk at troutmask dot apl dot washington dot edu @ 2005-02-17 23:16 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From sgk at troutmask dot apl dot washington dot edu 2005-02-17 19:17 -------
Tobi, thanks for adding me to the CC list. Andrew's patch
fixes the problems with BLAS. I extemely happy someone else
was able to find a small testcase, because I was starting
to trim 10K LOC.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=20030
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug middle-end/20030] [4.0 Regression] Broken arguments access
2005-02-17 20:30 [Bug middle-end/20030] New: Broken arguments access grigory dot zagorodnev at intel dot com
` (7 preceding siblings ...)
2005-02-17 23:16 ` sgk at troutmask dot apl dot washington dot edu
@ 2005-02-18 20:22 ` cvs-commit at gcc dot gnu dot org
2005-02-18 20:25 ` pinskia at gcc dot gnu dot org
2005-02-18 20:27 ` cvs-commit at gcc dot gnu dot org
10 siblings, 0 replies; 12+ messages in thread
From: cvs-commit at gcc dot gnu dot org @ 2005-02-18 20:22 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From cvs-commit at gcc dot gnu dot org 2005-02-18 14:32 -------
Subject: Bug 20030
CVSROOT: /cvs/gcc
Module name: gcc
Changes by: pinskia@gcc.gnu.org 2005-02-18 14:31:54
Modified files:
gcc : ChangeLog fold-const.c
Log message:
2005-02-18 Andrew Pinski <pinskia@physics.uc.edu>
PR middle-end/20030
* fold-const.c (fold_indirect_ref_1): Use the correct index for zero access,
the lower bound of the array type if it exists.
Patches:
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/ChangeLog.diff?cvsroot=gcc&r1=2.7523&r2=2.7524
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/fold-const.c.diff?cvsroot=gcc&r1=1.514&r2=1.515
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=20030
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug middle-end/20030] [4.0 Regression] Broken arguments access
2005-02-17 20:30 [Bug middle-end/20030] New: Broken arguments access grigory dot zagorodnev at intel dot com
` (8 preceding siblings ...)
2005-02-18 20:22 ` cvs-commit at gcc dot gnu dot org
@ 2005-02-18 20:25 ` pinskia at gcc dot gnu dot org
2005-02-18 20:27 ` cvs-commit at gcc dot gnu dot org
10 siblings, 0 replies; 12+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-02-18 20:25 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From pinskia at gcc dot gnu dot org 2005-02-18 14:37 -------
Fixed.
------- Additional Comments From cvs-commit at gcc dot gnu dot org 2005-02-18 14:37 -------
Subject: Bug 20030
CVSROOT: /cvs/gcc
Module name: gcc
Changes by: pinskia@gcc.gnu.org 2005-02-18 14:36:55
Modified files:
gcc/testsuite : ChangeLog
Added files:
gcc/testsuite/gfortran.fortran-torture/execute:
character_passing.f90
Log message:
2004-02-18 Andrew Pinski <pinskia@physics.uc.edu>
PR middle-end/20030
* gfortran.fortran-torture/execute/character_passing.f90: New test.
Patches:
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/ChangeLog.diff?cvsroot=gcc&r1=1.5047&r2=1.5048
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/gfortran.fortran-torture/execute/character_passing.f90.diff?cvsroot=gcc&r1=NONE&r2=1.1
--
What |Removed |Added
----------------------------------------------------------------------------
Status|ASSIGNED |RESOLVED
Resolution| |FIXED
Target Milestone|--- |4.0.0
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=20030
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug middle-end/20030] [4.0 Regression] Broken arguments access
2005-02-17 20:30 [Bug middle-end/20030] New: Broken arguments access grigory dot zagorodnev at intel dot com
` (9 preceding siblings ...)
2005-02-18 20:25 ` pinskia at gcc dot gnu dot org
@ 2005-02-18 20:27 ` cvs-commit at gcc dot gnu dot org
10 siblings, 0 replies; 12+ messages in thread
From: cvs-commit at gcc dot gnu dot org @ 2005-02-18 20:27 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From pinskia at gcc dot gnu dot org 2005-02-18 14:37 -------
Fixed.
------- Additional Comments From cvs-commit at gcc dot gnu dot org 2005-02-18 14:37 -------
Subject: Bug 20030
CVSROOT: /cvs/gcc
Module name: gcc
Changes by: pinskia@gcc.gnu.org 2005-02-18 14:36:55
Modified files:
gcc/testsuite : ChangeLog
Added files:
gcc/testsuite/gfortran.fortran-torture/execute:
character_passing.f90
Log message:
2004-02-18 Andrew Pinski <pinskia@physics.uc.edu>
PR middle-end/20030
* gfortran.fortran-torture/execute/character_passing.f90: New test.
Patches:
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/ChangeLog.diff?cvsroot=gcc&r1=1.5047&r2=1.5048
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/gfortran.fortran-torture/execute/character_passing.f90.diff?cvsroot=gcc&r1=NONE&r2=1.1
--
What |Removed |Added
----------------------------------------------------------------------------
Status|ASSIGNED |RESOLVED
Resolution| |FIXED
Target Milestone|--- |4.0.0
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=20030
^ permalink raw reply [flat|nested] 12+ messages in thread
end of thread, other threads:[~2005-02-18 14:37 UTC | newest]
Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-02-17 20:30 [Bug middle-end/20030] New: Broken arguments access grigory dot zagorodnev at intel dot com
2005-02-17 21:21 ` [Bug middle-end/20030] " pinskia at gcc dot gnu dot org
2005-02-17 21:26 ` pinskia at gcc dot gnu dot org
2005-02-17 21:28 ` [Bug middle-end/20030] [4.0 Regression] " pinskia at gcc dot gnu dot org
2005-02-17 21:36 ` pinskia at gcc dot gnu dot org
2005-02-17 21:41 ` pinskia at gcc dot gnu dot org
2005-02-17 22:16 ` pinskia at gcc dot gnu dot org
2005-02-17 22:39 ` tobi at gcc dot gnu dot org
2005-02-17 23:16 ` sgk at troutmask dot apl dot washington dot edu
2005-02-18 20:22 ` cvs-commit at gcc dot gnu dot org
2005-02-18 20:25 ` pinskia at gcc dot gnu dot org
2005-02-18 20:27 ` cvs-commit at gcc dot gnu dot org
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).