This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug fortran/32002] New: insufficient conformance check when assigning the result of an elemental function to an array


The problem shown here applies to elemental functions in general, not only
(elemental) intrinsics, see below for an example:

$> cat assign.f90
real :: a(3) = 0.0, b(2) = (/ 0.0, 0.1 /)
a = COS(b)
print *, a
end

$> gfortran-svn assign.f90 && ./a.out
   1.000000      0.9950042       1.000000


$> ifort -warn all assign.f90 && ./a.out
fortcom: Error: assign.f90, line 2: The shapes of the array expressions do not
conform.   [A]
a = COS(b)
^
compilation aborted for assign.f90 (code 1)

$> sunf95 -w4 assign.f90 && ./a.out

a = COS(b)
  ^
"assign.f90", Line = 2, Column = 3: ERROR: The left and right hand sides of
this array syntax assignment must be conformable arrays.

f90comp: 4 SOURCE LINES
f90comp: 1 ERRORS, 0 WARNINGS, 0 OTHER MESSAGES, 0 ANSI

Same example as above with elemental function:

$> cat assign.f90
real :: a(3) = 0.0, b(2) = (/ 0.0, 0.1 /)
a = f(b)
print *, a

contains
  real elemental function f(x)
    real, INTENT(iN) :: x
    f = cos(x)
  end function
end

$> gfortran-svn assign.f90 && ./a.out
   1.000000      0.9950042       1.000000


-- 
           Summary: insufficient conformance check when assigning the result
                    of an elemental function to an array
           Product: gcc
           Version: 4.3.0
            Status: UNCONFIRMED
          Keywords: accepts-invalid
          Severity: normal
          Priority: P3
         Component: fortran
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: dfranke at gcc dot gnu dot org


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]