[RFA] Bug 84094 - several correctness issues in gfortran.dg

Message ID CB3785CC-5438-4EB5-B828-B763CCCB20B2@lps.ens.fr
State New
Headers show
Series
  • [RFA] Bug 84094 - several correctness issues in gfortran.dg
Related show

Commit Message

Dominique d'Humières Feb. 4, 2018, 1:01 p.m.
Is the following patch OK? For associate_23.f90 I have restricted should_work to two elements, an alternative would be to use ASSOCIATE(should_work=>char_var_dim(1:3)); any preference?

Note that none of these invalid codes are detected by gfortran, except intrinsic_actual_4.f90 which gives a confusing warning

       i = len ("123")
             1
Warning: Type specified for intrinsic function 'len' at (1) is ignored [-Wsurprising]

when compiled with -Wall.

Should I open PRs for these missing/confusing diagnostics?

TIA

Dominique

Comments

Paul Richard Thomas Feb. 4, 2018, 1:14 p.m. | #1
Hi Dominique,

The patch is OK.

By all means open the PR for the missing/confusing diagnostics.

Thanks

Paul


On 4 February 2018 at 13:01, Dominique d'Humières <dominiq@lps.ens.fr> wrote:
> Is the following patch OK? For associate_23.f90 I have restricted should_work to two elements, an alternative would be to use ASSOCIATE(should_work=>char_var_dim(1:3)); any preference?

>

> Note that none of these invalid codes are detected by gfortran, except intrinsic_actual_4.f90 which gives a confusing warning

>

>        i = len ("123")

>              1

> Warning: Type specified for intrinsic function 'len' at (1) is ignored [-Wsurprising]

>

> when compiled with -Wall.

>

> Should I open PRs for these missing/confusing diagnostics?

>

> TIA

>

> Dominique

>

> --- ../_clean/gcc/testsuite/gfortran.dg/matmul_3.f90    2009-11-25 18:17:41.000000000 +0100

> +++ gcc/testsuite/gfortran.dg/matmul_3.f90      2018-02-04 13:25:39.000000000 +0100

> @@ -22,7 +22,7 @@

>     iX2(1:n,1) = matmul( iB(2,1:n),iC(1:n,1:n) )

>

>  ! Whereas, we should have 8, 8, 99

> -   if (any (iX1(1:n,1) .ne. (/8, 8, 99/))) call abort ()

> +   if (any (iX1(1:n+1,1) .ne. (/8, 8, 99/))) call abort ()

>     if (any (iX1 .ne. iX2)) call abort ()

>

>  ! Make sure that the fix does not break transpose temporaries.

> --- ../_clean/gcc/testsuite/gfortran.dg/associate_23.f90        2016-11-04 20:34:00.000000000 +0100

> +++ gcc/testsuite/gfortran.dg/associate_23.f90  2018-02-04 13:28:18.000000000 +0100

> @@ -27,7 +27,8 @@ program test_this

>

>  ! Found to be failing during debugging

>    ASSOCIATE(should_work=>char_var_dim(1:2))

> -    should_work = ["test SUCCESFUL", "test_SUCCESFUL", "test.SUCCESFUL"]

> +!    should_work = ["test SUCCESFUL", "test_SUCCESFUL", "test.SUCCESFUL"]

> +    should_work = ["test SUCCESFUL", "test_SUCCESFUL"]

>      write (buffer, *) should_work(:)(5:14)

>    END ASSOCIATE

>

> --- ../_clean/gcc/testsuite/gfortran.dg/transfer_array_intrinsic_2.f90  2009-11-25 18:17:42.000000000 +0100

> +++ gcc/testsuite/gfortran.dg/transfer_array_intrinsic_2.f90    2018-02-04 13:40:17.000000000 +0100

> @@ -88,7 +88,7 @@ contains

>       ch(1:2) = transfer (y, ch, 2)

>       if (any (ch(1:2) .ne. (/"ABCD","EFGH"/))) call abort ()

>

> -     z = transfer (ch, y)

> +     z = transfer (ch, y, 2)

>       if (any (y(1:2) .ne. z)) call abort ()

>

>     end subroutine test2

> --- ../_clean/gcc/testsuite/gfortran.dg/intrinsic_actual_4.f90  2009-11-25 18:17:49.000000000 +0100

> +++ gcc/testsuite/gfortran.dg/intrinsic_actual_4.f90    2018-02-04 13:48:05.000000000 +0100

> @@ -13,6 +13,7 @@

>

>        implicit none

>        integer i

> +      intrinsic len

>        i = len ("123")

>        call sub (len, "abcdef")

>        end

>




-- 
"If you can't explain it simply, you don't understand it well enough"
- Albert Einstein

Patch

--- ../_clean/gcc/testsuite/gfortran.dg/matmul_3.f90	2009-11-25 18:17:41.000000000 +0100
+++ gcc/testsuite/gfortran.dg/matmul_3.f90	2018-02-04 13:25:39.000000000 +0100
@@ -22,7 +22,7 @@ 
    iX2(1:n,1) = matmul( iB(2,1:n),iC(1:n,1:n) )
 
 ! Whereas, we should have 8, 8, 99
-   if (any (iX1(1:n,1) .ne. (/8, 8, 99/))) call abort ()
+   if (any (iX1(1:n+1,1) .ne. (/8, 8, 99/))) call abort ()
    if (any (iX1 .ne. iX2)) call abort ()
 
 ! Make sure that the fix does not break transpose temporaries.
--- ../_clean/gcc/testsuite/gfortran.dg/associate_23.f90	2016-11-04 20:34:00.000000000 +0100
+++ gcc/testsuite/gfortran.dg/associate_23.f90	2018-02-04 13:28:18.000000000 +0100
@@ -27,7 +27,8 @@  program test_this
 
 ! Found to be failing during debugging
   ASSOCIATE(should_work=>char_var_dim(1:2))
-    should_work = ["test SUCCESFUL", "test_SUCCESFUL", "test.SUCCESFUL"]
+!    should_work = ["test SUCCESFUL", "test_SUCCESFUL", "test.SUCCESFUL"]
+    should_work = ["test SUCCESFUL", "test_SUCCESFUL"]
     write (buffer, *) should_work(:)(5:14)
   END ASSOCIATE
 
--- ../_clean/gcc/testsuite/gfortran.dg/transfer_array_intrinsic_2.f90	2009-11-25 18:17:42.000000000 +0100
+++ gcc/testsuite/gfortran.dg/transfer_array_intrinsic_2.f90	2018-02-04 13:40:17.000000000 +0100
@@ -88,7 +88,7 @@  contains
      ch(1:2) = transfer (y, ch, 2)
      if (any (ch(1:2) .ne. (/"ABCD","EFGH"/))) call abort ()
 
-     z = transfer (ch, y)
+     z = transfer (ch, y, 2)
      if (any (y(1:2) .ne. z)) call abort ()
 
    end subroutine test2
--- ../_clean/gcc/testsuite/gfortran.dg/intrinsic_actual_4.f90	2009-11-25 18:17:49.000000000 +0100
+++ gcc/testsuite/gfortran.dg/intrinsic_actual_4.f90	2018-02-04 13:48:05.000000000 +0100
@@ -13,6 +13,7 @@ 
 
       implicit none
       integer i
+      intrinsic len
       i = len ("123")
       call sub (len, "abcdef")
       end