[Bug middle-end/22509] New: [4.1 regression] elemental.f90 testsuite failure

tkoenig at gcc dot gnu dot org gcc-bugzilla@gcc.gnu.org
Sat Jul 16 09:46:00 GMT 2005


This fails with

$ gfortran -O3 -funroll-loops elemental.f90
$ ./a.out
Aborted

Slightly reduced:

$ cat elemental-reduced.f90
! Program to test elemental functions.
program test_elemental
   implicit none
   integer(kind = 4), dimension (2, 4) :: a
   integer(kind = 4), dimension (2, 4) :: b
   integer(kind = 8), dimension(2) :: c

   a = reshape ((/2, 3, 4, 5, 6, 7, 8, 9/), (/2, 4/))
   b = 0
   b(2, :) = e_fn (a(1, :), 1)
   if (any (b .ne. reshape ((/0, 1, 0, 3, 0, 5, 0, 7/), (/2, 4/)))) call abort
   a = e_fn (a(:, 4:1:-1), 1 + b)
   print '(8I4)',a
   if (any (a .ne. reshape ((/7, 7, 5, 3, 3, -1, 1, -5/), (/2, 4/)))) call abort

contains

elemental integer function e_fn (p, q)
   integer, intent(in) :: p, q
   e_fn = p - q
end function
end program
$ cat elemental-reduced.f90
! Program to test elemental functions.
program test_elemental
   implicit none
   integer(kind = 4), dimension (2, 4) :: a
   integer(kind = 4), dimension (2, 4) :: b
   integer(kind = 8), dimension(2) :: c

   a = reshape ((/2, 3, 4, 5, 6, 7, 8, 9/), (/2, 4/))
   b = 0
   b(2, :) = e_fn (a(1, :), 1)
   if (any (b .ne. reshape ((/0, 1, 0, 3, 0, 5, 0, 7/), (/2, 4/)))) call abort
   a = e_fn (a(:, 4:1:-1), 1 + b)
   print '(8I4)',a
   if (any (a .ne. reshape ((/7, 7, 5, 3, 3, -1, 1, -5/), (/2, 4/)))) call abort

contains

elemental integer function e_fn (p, q)
   integer, intent(in) :: p, q
   e_fn = p - q
end function
end program
$ gfortran elemental-reduced.f90 && ./a.out
   7   7   5   3   3  -1   1  -5
$ gfortran -O3 elemental-reduced.f90 && ./a.out
   7   7   5   3   3  -1   1  -5
$ gfortran -O3 -funroll-loops elemental-reduced.f90 && ./a.out
   7   7   5   3   4  -3   6  -1
Aborted

-- 
           Summary: [4.1 regression] elemental.f90 testsuite failure
           Product: gcc
           Version: 4.1.0
            Status: UNCONFIRMED
          Keywords: wrong-code
          Severity: normal
          Priority: P2
         Component: middle-end
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: tkoenig at gcc dot gnu dot org
                CC: gcc-bugs at gcc dot gnu dot org


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



More information about the Gcc-bugs mailing list