[Bug fortran/77903] [F08] gfortran 6.1.0/7.0.0 accept invalid code with conflicting module/submodule interfaces

2016-12-09 Thread pault at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=77903

Paul Thomas  changed:

   What|Removed |Added

 Status|NEW |RESOLVED
 Resolution|--- |FIXED

--- Comment #13 from Paul Thomas  ---
Fixed on trunk.

Thanks for the report.

Paul

[Bug fortran/77903] [F08] gfortran 6.1.0/7.0.0 accept invalid code with conflicting module/submodule interfaces

2016-12-09 Thread pault at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=77903

--- Comment #12 from Paul Thomas  ---
Author: pault
Date: Fri Dec  9 22:25:26 2016
New Revision: 243507

URL: https://gcc.gnu.org/viewcvs?rev=243507=gcc=rev
Log:
2016-12-09  Paul Thomas  

PR fortran/77903
* decl.c (get_proc_name): Use the symbol tlink field instead of
the typespec interface field.
(gfc_match_function_decl, gfc_match_submod_proc): Ditto.
* gfortran.h : Since the symbol tlink field is no longer used
by the frontend for change management, change the comment to
reflect its current uses.
* parse.c (get_modproc_result): Same as decl.c changes.
* resolve.c (resolve_fl_procedure): Ditto.

2016-12-09  Paul Thomas  

PR fortran/77903
* gfortran.dg/submodule_20.f08: New test.

Added:
trunk/gcc/testsuite/gfortran.dg/submodule_20.f08
Modified:
trunk/gcc/fortran/ChangeLog
trunk/gcc/fortran/decl.c
trunk/gcc/fortran/gfortran.h
trunk/gcc/fortran/parse.c
trunk/gcc/fortran/resolve.c
trunk/gcc/testsuite/ChangeLog

[Bug fortran/77903] [F08] gfortran 6.1.0/7.0.0 accept invalid code with conflicting module/submodule interfaces

2016-12-05 Thread pault at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=77903

Paul Thomas  changed:

   What|Removed |Added

  Attachment #40256|0   |1
is obsolete||

--- Comment #11 from Paul Thomas  ---
Created attachment 40257
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=40257=edit
It helps to attach the right patch!

duuh!

[Bug fortran/77903] [F08] gfortran 6.1.0/7.0.0 accept invalid code with conflicting module/submodule interfaces

2016-12-05 Thread pault at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=77903

Paul Thomas  changed:

   What|Removed |Added

  Attachment #40237|0   |1
is obsolete||

--- Comment #10 from Paul Thomas  ---
Created attachment 40256
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=40256=edit
An infinitely better fix

This one bootstraps and regtests OK.

Will submit in a couple of minutes.

Paul

[Bug fortran/77903] [F08] gfortran 6.1.0/7.0.0 accept invalid code with conflicting module/submodule interfaces

2016-12-03 Thread pault at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=77903

--- Comment #9 from Paul Thomas  ---
Created attachment 40237
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=40237=edit
Fix for the PR

This is still a bit rough round the edges but it fixes the PR, regtests and
bootstraps with this testcase:

! { dg-do compile }
!
! Test the fix for PR77903
!
! Contributed by Damian Rouson  
!
module one_module
  implicit none
  interface
module function one()
end function
integer module function two()
end function
  end interface
end module

submodule(one_module) one_submodule
  implicit none
contains
  integer module function one()  ! { dg-error "Type mismatch" }
one = 1
  end function
  integer(8) module function two()  ! { dg-error "Type mismatch" }
two = 2
  end function
end submodule

I am back in France tomorrow night and will tidy up and submit on Monday.

Cheers

Paul

[Bug fortran/77903] [F08] gfortran 6.1.0/7.0.0 accept invalid code with conflicting module/submodule interfaces

2016-11-27 Thread pault at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=77903

--- Comment #8 from Paul Thomas  ---
(In reply to Damian Rouson from comment #0)
> Gfortran accepts invalid code in which an implicitly typed interface body
> has the same name as a conflicting, explicitly typed module function
> implemented in a submodule.  See below.
> 
> Damian
> 
> 
> $ cat one.f90
> module one_module
>   implicit none
>   interface
> module function one()
> end function
>   end interface
> end module
> 
> submodule(one_module) one_submodule
>   implicit none
> contains
>   integer module function one()
> one = 1
>   end function
> end submodule  
> 
> use one_module
> print *,one()," is not ",1
> end 
> 
> $ gfortran -std=f2008 -Wall -fcheck=all one.f90 
> 
> $ ./a.out
>9.18340949E-41  is not1
> 
> $ gfortran --version
> GNU Fortran (MacPorts gcc6 6.1.0_0) 6.1.0

Interestingly, ifort accepts this and imposes the interface definition to the
extent of making the type conversion.

I will have to dwell some more on this.

Paul