public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "kkojima at gcc dot gnu dot org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug fortran/36403]  New: [4.4 Regression] Some fortran tests using eoshift fail on SH
Date: Sat, 31 May 2008 23:41:00 -0000	[thread overview]
Message-ID: <bug-36403-5208@http.gcc.gnu.org/bugzilla/> (raw)

Several fortran tests using eoshift fail for SH.  The typical one is

gfortran.dg/char_length_8.f90  -O0  execution test

and its reduced testcase is

  CHARACTER(LEN=3), DIMENSION(10) :: Z
  call test_eoshift
contains
  subroutine test_eoshift 
    CHARACTER(LEN=1), DIMENSION(10) :: chk
    chk(1:8) = "5"
    chk(9:10) = " "
    Z(:)="456"
    if (any (EOSHIFT(Z(:)(2:2),2) .ne. chk)) call abort 
  END subroutine
END

It seems that a variable on stack is clobbered by the call of
_gfortran_eoshift0_4_char and it's resulting a segfault.

In .003t.original tree dump, that call

    _gfortran_eoshift0_4_char (&atmp.8, 1, &atmp.4, &C.651, 0B, 0B, 1);

has 7 arguments, but it doesn't match with the prototype of

  void                                                                        \
  eoshift0_##N##_char (gfc_array_char *ret,                                   \
                       GFC_INTEGER_4 ret_length __attribute__((unused)),      \
                       const gfc_array_char *array,                           \
                       const GFC_INTEGER_##N *pshift,                         \
                       const char *pbound,                                    \
                       const GFC_INTEGER_##N *pdim,                           \
                       GFC_INTEGER_4 array_length,                            \
                       GFC_INTEGER_4 bound_length __attribute__((unused)))    \
  {                                                                           \
    eoshift0 (ret, array, *pshift, pbound, pdim ? *pdim : 1,                  \
              array_length, " ", 1);                                          \
  }                                                                           \

in libgfortran/intrinsics/eoshift0.c which has 8 arguments.
Then the caller gives the stack area only for 7 arguments, but
the callee assumes the stack area is reserved for 8 arguments
and uses them for temporary purpose in the failing case.


-- 
           Summary: [4.4 Regression] Some fortran tests using eoshift fail
                    on SH
           Product: gcc
           Version: 4.4.0
            Status: UNCONFIRMED
          Keywords: wrong-code
          Severity: normal
          Priority: P3
         Component: fortran
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: kkojima at gcc dot gnu dot org
GCC target triplet: sh4-unknown-linux-gnu


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=36403


             reply	other threads:[~2008-05-31 23:41 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-05-31 23:41 kkojima at gcc dot gnu dot org [this message]
2008-06-02 11:30 ` [Bug fortran/36403] " fxcoudert at gcc dot gnu dot org
2008-06-11 11:13 ` jsm28 at gcc dot gnu dot org
2008-06-15 15:14 ` fxcoudert at gcc dot gnu dot org
2008-07-18 16:51 ` rguenth at gcc dot gnu dot org
2008-07-24 17:04 ` domob at gcc dot gnu dot org
2008-07-27 13:52 ` burnus at gcc dot gnu dot org
2008-07-28 18:42 ` domob at gcc dot gnu dot org
2008-07-28 18:42 ` domob at gcc dot gnu dot org
2008-07-28 20:04 ` burnus at gcc dot gnu dot org
2008-07-29  9:13 ` domob at gcc dot gnu dot org
2008-07-29  9:18 ` domob at gcc dot gnu dot org

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bug-36403-5208@http.gcc.gnu.org/bugzilla/ \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).