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

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