Bug 31929 - [4.1/4.2 only] atan2 accepts non-conforming array shapes
Summary: [4.1/4.2 only] atan2 accepts non-conforming array shapes
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: fortran (show other bugs)
Version: 4.3.0
: P3 normal
Target Milestone: 4.3.0
Assignee: Daniel Franke
URL: http://gcc.gnu.org/ml/gcc-patches/200...
Keywords: accepts-invalid, patch
Depends on:
Blocks:
 
Reported: 2007-05-15 09:16 UTC by Daniel Franke
Modified: 2007-06-16 22:54 UTC (History)
1 user (show)

See Also:
Host:
Target:
Build:
Known to work: 4.3.0
Known to fail: 4.1.2 4.2.1
Last reconfirmed: 2007-05-31 12:00:09


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Daniel Franke 2007-05-15 09:16:24 UTC
The following code is invalid as shapes of X and Y are not identical:

$> cat atan2.f90
real :: x(3), y(2)     ! same rank but different shapes
x = atan2(x,y)
end

$> gfortran-svn -fdump-tree-original atan2.f90
$> cat atan2.f90.003t.original
MAIN__ ()
{
  real4 y[2];
  real4 x[3];

  _gfortran_set_std (68, 127, 0, 0, 0);
  {
    int4 S.0;

    S.0 = 1;
    while (1)
      {
        if (S.0 > 3) goto L.1;
        x[S.0 + -1] = __builtin_atan2f (x[S.0 + -1], y[S.0 + -1]);
        S.0 = S.0 + 1;
      }
    L.1:;
  }
}

$> gfortran-svn -v
gcc version 4.3.0 20070502 (experimental)
Comment 1 Daniel Franke 2007-05-17 13:37:51 UTC
Subject: Bug 31929

Author: dfranke
Date: Thu May 17 12:37:24 2007
New Revision: 124794

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=124794
Log:
gcc/fortran:
2007-05-15  Daniel Franke  <franke.daniel@gmail.com>

        PR fortran/31919
        PR fortran/31929
        PR fortran/31930
        * intrinsic.c (check_specific): Check elemental intrinsics for
        rank and shape.
        (add_functions): Fixed dummy argument names of BESJN and BESYN.
        Fixed elemental status of MCLOCK and MCLOCK8.
        * check.c (check_rest): Added check for array conformance.
        (gfc_check_merge): Removed check for array conformance.
        (gfc_check_besn): Removed check for scalarity.
        * intrinsic.texi (CSHIFT, EOSHIFT): Fixed typos.
        (BESJN, BESYN): Clarified documentation.

gcc/testsuite:
2007-05-17  Daniel Franke <franke.daniel@gmail.com>

        PR fortran/31919
        * gfortran.dg/min_max_conformance.f90: New test.


Added:
    trunk/gcc/testsuite/gfortran.dg/min_max_conformance.f90
Modified:
    trunk/gcc/fortran/ChangeLog
    trunk/gcc/fortran/check.c
    trunk/gcc/fortran/intrinsic.c
    trunk/gcc/fortran/intrinsic.texi
    trunk/gcc/testsuite/ChangeLog

Comment 2 Francois-Xavier Coudert 2007-05-31 12:00:09 UTC
I don't think we should backport that to 4.2, as it's not a regression AFAICS. Can you close it? (or, if you think it's worth backporting, ask for opinions on the mailing-list?)
Comment 3 Daniel Franke 2007-06-16 22:54:54 UTC
Not a regression, no backport to 4.2. Closing