diff options
author | Thomas Koenig <tkoenig@gcc.gnu.org> | 2019-08-15 22:52:40 +0000 |
---|---|---|
committer | Thomas Koenig <tkoenig@gcc.gnu.org> | 2019-08-15 22:52:40 +0000 |
commit | fb078366c749168c86a97df8423eb0b8f2c948b2 (patch) | |
tree | a1402a54686f1b73e81b7548effd9221a7061b04 /gcc/testsuite | |
parent | 7148dede8a84e17cc0b00190d76fabbc1a717654 (diff) | |
download | gcc-fb078366c749168c86a97df8423eb0b8f2c948b2.zip gcc-fb078366c749168c86a97df8423eb0b8f2c948b2.tar.gz gcc-fb078366c749168c86a97df8423eb0b8f2c948b2.tar.bz2 |
re PR fortran/91443 (-Wargument-mismatch does not catch mismatch for global procedure)
2019-08-15 Thomas Koenig <tkoenig@gcc.gnu.org>
PR fortran/91443
* frontend-passes.c (check_externals_expr): New function.
(check_externals_code): New function.
(gfc_check_externals): New function.
* gfortran.h (debug): Add prototypes for gfc_symbol * and
gfc_expr *.
(gfc_check_externals): Add prototype.
* interface.c (compare_actual_formal): Do not complain about
alternate returns if the formal argument is optional.
(gfc_procedure_use): Handle cases when an error has been issued
previously. Break long line.
* parse.c (gfc_parse_file): Call gfc_check_externals for all
external procedures.
* resolve.c (resolve_global_procedure): Remove checking of
argument list.
2019-08-15 Thomas Koenig <tkoenig@gcc.gnu.org>
PR fortran/91443
* gfortran.dg/argument_checking_19.f90: New test.
* gfortran.dg/altreturn_10.f90: Change dg-warning to dg-error.
* gfortran.dg/dec_union_11.f90: Add -std=legacy.
* gfortran.dg/hollerith8.f90: Likewise. Remove warning for
Hollerith constant.
* gfortran.dg/integer_exponentiation_2.f90: New subroutine gee_i8;
use it to avoid type mismatches.
* gfortran.dg/pr41011.f: Add -std=legacy.
* gfortran.dg/whole_file_1.f90: Change warnings to errors.
* gfortran.dg/whole_file_2.f90: Likewise.
From-SVN: r274551
Diffstat (limited to 'gcc/testsuite')
-rw-r--r-- | gcc/testsuite/ChangeLog | 14 | ||||
-rw-r--r-- | gcc/testsuite/gfortran.dg/altreturn_10.f90 | 2 | ||||
-rw-r--r-- | gcc/testsuite/gfortran.dg/argument_checking_19.f90 | 18 | ||||
-rw-r--r-- | gcc/testsuite/gfortran.dg/dec_union_11.f90 | 2 | ||||
-rw-r--r-- | gcc/testsuite/gfortran.dg/hollerith8.f90 | 6 | ||||
-rw-r--r-- | gcc/testsuite/gfortran.dg/integer_exponentiation_2.f90 | 24 | ||||
-rw-r--r-- | gcc/testsuite/gfortran.dg/pr41011.f | 2 | ||||
-rw-r--r-- | gcc/testsuite/gfortran.dg/whole_file_1.f90 | 4 | ||||
-rw-r--r-- | gcc/testsuite/gfortran.dg/whole_file_2.f90 | 4 |
9 files changed, 55 insertions, 21 deletions
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index a21600b..aeaaac0 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,17 @@ +2019-08-15 Thomas Koenig <tkoenig@gcc.gnu.org> + + PR fortran/91443 + * gfortran.dg/argument_checking_19.f90: New test. + * gfortran.dg/altreturn_10.f90: Change dg-warning to dg-error. + * gfortran.dg/dec_union_11.f90: Add -std=legacy. + * gfortran.dg/hollerith8.f90: Likewise. Remove warning for + Hollerith constant. + * gfortran.dg/integer_exponentiation_2.f90: New subroutine gee_i8; + use it to avoid type mismatches. + * gfortran.dg/pr41011.f: Add -std=legacy. + * gfortran.dg/whole_file_1.f90: Change warnings to errors. + * gfortran.dg/whole_file_2.f90: Likewise. + 2019-08-15 Richard Biener <rguenther@suse.de> PR tree-optimization/91445 diff --git a/gcc/testsuite/gfortran.dg/altreturn_10.f90 b/gcc/testsuite/gfortran.dg/altreturn_10.f90 index 7e5d569..a388c3c 100644 --- a/gcc/testsuite/gfortran.dg/altreturn_10.f90 +++ b/gcc/testsuite/gfortran.dg/altreturn_10.f90 @@ -14,6 +14,6 @@ subroutine sub (x) end subroutine sub2 call sub (*99) ! { dg-error "Unexpected alternate return specifier" } - call sub (99.) ! { dg-warning "Type mismatch in argument" } + call sub (99.) ! { dg-error "Type mismatch in argument" } 99 stop end diff --git a/gcc/testsuite/gfortran.dg/argument_checking_19.f90 b/gcc/testsuite/gfortran.dg/argument_checking_19.f90 new file mode 100644 index 0000000..4460226 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/argument_checking_19.f90 @@ -0,0 +1,18 @@ +! { dg-do compile } +! PR 91443 - this was not caught. +module x +contains + subroutine a + call foo(1) ! { dg-error "Type mismatch in argument" } + end subroutine a +end module x + +subroutine foo(a) + real :: a + print *,a +end subroutine foo + +program main + use x + call a +end program main diff --git a/gcc/testsuite/gfortran.dg/dec_union_11.f90 b/gcc/testsuite/gfortran.dg/dec_union_11.f90 index 3ff4b49..41e23b2 100644 --- a/gcc/testsuite/gfortran.dg/dec_union_11.f90 +++ b/gcc/testsuite/gfortran.dg/dec_union_11.f90 @@ -1,5 +1,5 @@ ! { dg-do compile } -! { dg-options "-g -fdec-structure" } +! { dg-options "-g -fdec-structure -std=legacy" } ! ! Test a regression where typespecs of unions containing character buffers of ! different lengths where copied, resulting in a bad gimple tree state. diff --git a/gcc/testsuite/gfortran.dg/hollerith8.f90 b/gcc/testsuite/gfortran.dg/hollerith8.f90 index b9f25d0..384904d 100644 --- a/gcc/testsuite/gfortran.dg/hollerith8.f90 +++ b/gcc/testsuite/gfortran.dg/hollerith8.f90 @@ -1,9 +1,9 @@ ! { dg-do run } -! { dg-options "-std=gnu" } +! { dg-options "-std=legacy" } ! PR43217 Output of Hollerith constants which are not a multiple of 4 bytes ! Test case prepared from OP by Jerry DeLisle <jvdelisle@gcc.gnu.org> program hello2 - call wrtout (9hHELLO YOU, 9) + call wrtout (9hHELLO YOU, 9) ! { dg-warning "Rank mismatch" } stop end @@ -22,5 +22,3 @@ subroutine wrtout (iarray, nchrs) & outstr.ne."48454C4C 4F20594F 55202020") STOP 1 return end -! { dg-warning "Hollerith constant" "" { target *-*-* } 6 } -! { dg-warning "Rank mismatch" "" { target *-*-* } 6 } diff --git a/gcc/testsuite/gfortran.dg/integer_exponentiation_2.f90 b/gcc/testsuite/gfortran.dg/integer_exponentiation_2.f90 index 41f4cbf..ec018ff 100644 --- a/gcc/testsuite/gfortran.dg/integer_exponentiation_2.f90 +++ b/gcc/testsuite/gfortran.dg/integer_exponentiation_2.f90 @@ -139,16 +139,16 @@ subroutine foo(a) call gee_i(i**(-huge(0_4))) call gee_i(i**(-huge(0_4)-1_4)) - call gee_i(i**0_8) ! { dg-warning "Type mismatch in argument" } - call gee_i(i**1_8) ! { dg-warning "Type mismatch in argument" } - call gee_i(i**2_8) ! { dg-warning "Type mismatch in argument" } - call gee_i(i**3_8) ! { dg-warning "Type mismatch in argument" } - call gee_i(i**(-1_8)) ! { dg-warning "Type mismatch in argument" } - call gee_i(i**(-2_8)) ! { dg-warning "Type mismatch in argument" } - call gee_i(i**(-3_8)) ! { dg-warning "Type mismatch in argument" } - call gee_i(i**huge(0_8)) ! { dg-warning "Type mismatch in argument" } - call gee_i(i**(-huge(0_8))) ! { dg-warning "Type mismatch in argument" } - call gee_i(i**(-huge(0_8)-1_8)) ! { dg-warning "Type mismatch in argument" } + call gee_i8(i**0_8) + call gee_i8(i**1_8) + call gee_i8(i**2_8) + call gee_i8(i**3_8) + call gee_i8(i**(-1_8)) + call gee_i8(i**(-2_8)) + call gee_i8(i**(-3_8)) + call gee_i8(i**huge(0_8)) + call gee_i8(i**(-huge(0_8))) + call gee_i8(i**(-huge(0_8)-1_8)) ! Real call gee_r(a**0_1) @@ -245,6 +245,10 @@ subroutine gee_i(i) integer :: i end subroutine gee_i +subroutine gee_i8(i) + integer(kind=8) :: i +end subroutine gee_i8 + subroutine gee_r(r) real :: r end subroutine gee_r diff --git a/gcc/testsuite/gfortran.dg/pr41011.f b/gcc/testsuite/gfortran.dg/pr41011.f index 83e85fb..5a32185 100644 --- a/gcc/testsuite/gfortran.dg/pr41011.f +++ b/gcc/testsuite/gfortran.dg/pr41011.f @@ -1,5 +1,5 @@ ! { dg-do compile } -! { dg-options "-O3" } +! { dg-options "-O3 -std=legacy" } CALL UVSET(NX,NY,NZ,HVAR,ZET,NP,DZ,DKM,UM,VM,UG,VG,TM,DCDX, ! { dg-warning "Rank mismatch" } *ITY,ISH,NSMT,F) CALL DCTDX(NX,NY,NX1,NFILT,C(MLAG),DCDX(MLAG),HELP,HELPA, diff --git a/gcc/testsuite/gfortran.dg/whole_file_1.f90 b/gcc/testsuite/gfortran.dg/whole_file_1.f90 index bceb250..c865395 100644 --- a/gcc/testsuite/gfortran.dg/whole_file_1.f90 +++ b/gcc/testsuite/gfortran.dg/whole_file_1.f90 @@ -19,7 +19,7 @@ subroutine b integer :: u1 end type type (u) :: q - call a(q) ! { dg-warning "Type mismatch" } + call a(q) ! { dg-error "Type mismatch" } print *, q%u1 end subroutine @@ -36,7 +36,7 @@ subroutine d integer :: u1 end type type (u) :: q - call c(q) ! { dg-warning "Type mismatch" } + call c(q) ! { dg-error "Type mismatch" } print *, q%u1 end subroutine diff --git a/gcc/testsuite/gfortran.dg/whole_file_2.f90 b/gcc/testsuite/gfortran.dg/whole_file_2.f90 index 60163f4..0d44574 100644 --- a/gcc/testsuite/gfortran.dg/whole_file_2.f90 +++ b/gcc/testsuite/gfortran.dg/whole_file_2.f90 @@ -14,8 +14,8 @@ end function program gg real :: h character (5) :: chr = 'hello' -h = a(); ! { dg-warning "Missing actual argument" } -call test ([chr]) ! { dg-warning "Rank mismatch" } +h = a(); ! { dg-error "Missing actual argument" } +call test ([chr]) ! { dg-error "Rank mismatch" } end program gg subroutine test (a) |