public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/52729] New: Symbol has no implicit type in SELECT TYPE block
@ 2012-03-26 18:20 abenson at caltech dot edu
  2012-04-02  9:54 ` [Bug fortran/52729] " burnus at gcc dot gnu.org
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: abenson at caltech dot edu @ 2012-03-26 18:20 UTC (permalink / raw)
  To: gcc-bugs

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

             Bug #: 52729
           Summary: Symbol has no implicit type in SELECT TYPE block
    Classification: Unclassified
           Product: gcc
           Version: 4.8.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: fortran
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: abenson@caltech.edu


The following fails to compile with the latest gfortran 4.8 (r185768):

module testMod

  type testType
  end type testType

contains

  subroutine testSub()
    implicit none
    procedure(double precision ), pointer :: r
    class    (testType         ), pointer :: testObject
    double precision                      :: testVal

    select type (testObject)
    class is (testType)
       testVal=testFunc()
       r => testFunc
    end select
    return
  end subroutine testSub

  double precision function testFunc()
    implicit none
    return
  end function testFunc

end module testMod

$ gfortran -v
Using built-in specs.
COLLECT_GCC=gfortran
COLLECT_LTO_WRAPPER=/home/abenson/libexec/gcc/x86_64-unknown-linux-
gnu/4.8.0/lto-wrapper
Target: x86_64-unknown-linux-gnu
Configured with: ../gcc-4.7/configure --prefix=/home/abenson --enable-
languages=c,c++,fortran --disable-multilib --with-gmp=/home/abenson --with-
mpc=/home/abenson --with-mpfr=/home/abenson
Thread model: posix
gcc version 4.8.0 20120324 (experimental) (GCC) 

$ gfortran -c test.F90 -o test.o
test.F90:16.23:

       testVal=testFunc()
                       1
Error: Symbol 'testfunc' at (1) has no IMPLICIT type

Removing the "r => ...." line, removing the "select type", "class is" and "end 
select" lines or moving testFunc before testSub in the file all allow the code 
to compile successfully.


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [Bug fortran/52729] Symbol has no implicit type in SELECT TYPE block
  2012-03-26 18:20 [Bug fortran/52729] New: Symbol has no implicit type in SELECT TYPE block abenson at caltech dot edu
@ 2012-04-02  9:54 ` burnus at gcc dot gnu.org
  2012-04-11 13:09 ` burnus at gcc dot gnu.org
  2012-04-11 13:10 ` burnus at gcc dot gnu.org
  2 siblings, 0 replies; 4+ messages in thread
From: burnus at gcc dot gnu.org @ 2012-04-02  9:54 UTC (permalink / raw)
  To: gcc-bugs

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

Tobias Burnus <burnus at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |rejects-valid
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2012-04-02
                 CC|                            |burnus at gcc dot gnu.org
     Ever Confirmed|0                           |1

--- Comment #1 from Tobias Burnus <burnus at gcc dot gnu.org> 2012-04-02 09:54:32 UTC ---
That's an odd issue.

The problem only occurs if one has a BLOCK (or the SELECT TYPE or ASSOCIATE
constructs which use it internally).

At the same time, one needs to have the function on the LHS of both a procedure
call and a proc-pointer assignment.

I think that one somewhere only looks as the namespace and its parent
("ns->parent") instead of walking higher up.


Reduced example:

module testMod
  implicit none
contains
  subroutine testSub()
    procedure(double precision ), pointer :: r
    double precision                      :: testVal

    block
      testVal=testFunc()
      r => testFunc
    end block
  end subroutine testSub

  double precision function testFunc()
  end function testFunc
end module testMod


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [Bug fortran/52729] Symbol has no implicit type in SELECT TYPE block
  2012-03-26 18:20 [Bug fortran/52729] New: Symbol has no implicit type in SELECT TYPE block abenson at caltech dot edu
  2012-04-02  9:54 ` [Bug fortran/52729] " burnus at gcc dot gnu.org
@ 2012-04-11 13:09 ` burnus at gcc dot gnu.org
  2012-04-11 13:10 ` burnus at gcc dot gnu.org
  2 siblings, 0 replies; 4+ messages in thread
From: burnus at gcc dot gnu.org @ 2012-04-11 13:09 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #2 from Tobias Burnus <burnus at gcc dot gnu.org> 2012-04-11 13:08:38 UTC ---
Author: burnus
Date: Wed Apr 11 13:08:32 2012
New Revision: 186318

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=186318
Log:
2012-04-11  Tobias Burnus  <burnus@net-b.de>

        PR fortran/52729
        * resolve.c (resolve_symbol): Fix searching for parent NS decl.

2012-04-11  Tobias Burnus  <burnus@net-b.de>

        PR fortran/52729
        * gfortran.dg/block_11.f90: New.


Added:
    trunk/gcc/testsuite/gfortran.dg/block_11.f90
Modified:
    trunk/gcc/fortran/ChangeLog
    trunk/gcc/fortran/resolve.c
    trunk/gcc/testsuite/ChangeLog


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [Bug fortran/52729] Symbol has no implicit type in SELECT TYPE block
  2012-03-26 18:20 [Bug fortran/52729] New: Symbol has no implicit type in SELECT TYPE block abenson at caltech dot edu
  2012-04-02  9:54 ` [Bug fortran/52729] " burnus at gcc dot gnu.org
  2012-04-11 13:09 ` burnus at gcc dot gnu.org
@ 2012-04-11 13:10 ` burnus at gcc dot gnu.org
  2 siblings, 0 replies; 4+ messages in thread
From: burnus at gcc dot gnu.org @ 2012-04-11 13:10 UTC (permalink / raw)
  To: gcc-bugs

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

Tobias Burnus <burnus at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |FIXED

--- Comment #3 from Tobias Burnus <burnus at gcc dot gnu.org> 2012-04-11 13:09:42 UTC ---
FIXED on the 4.8 trunk.

Thanks for the report!


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2012-04-11 13:10 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-03-26 18:20 [Bug fortran/52729] New: Symbol has no implicit type in SELECT TYPE block abenson at caltech dot edu
2012-04-02  9:54 ` [Bug fortran/52729] " burnus at gcc dot gnu.org
2012-04-11 13:09 ` burnus at gcc dot gnu.org
2012-04-11 13:10 ` burnus at gcc dot gnu.org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).