public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "bardeau at iram dot fr" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug fortran/61404] New: Incorrect error message when misusing a structure component + explicit interface
Date: Tue, 03 Jun 2014 16:03:00 -0000	[thread overview]
Message-ID: <bug-61404-4@http.gcc.gnu.org/bugzilla/> (raw)

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61404

            Bug ID: 61404
           Summary: Incorrect error message when misusing a structure
                    component + explicit interface
           Product: gcc
           Version: 4.9.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: fortran
          Assignee: unassigned at gcc dot gnu.org
          Reporter: bardeau at iram dot fr

Dear gfortran developers,

gfortran issues an incorrect error message using the (invalid on purpose)
program below. It refers to the module providing the structure component,
instead of the actual line where the error lies (CALL statement). The bug is
observed with gfortran 4.9.0 but I also found it in gfortran 4.4.7, so it seems
to be here since a long time...


module gbl_message
  type :: mytype
    integer(kind=4) :: e
  end type mytype
  type(mytype), parameter :: seve = mytype(1)
end module gbl_message
!
module gbl_interfaces
  interface
    subroutine gagout(message)
      character(len=*), intent(in) :: message
    end subroutine gagout
  end interface
end module gbl_interfaces
!
program test
  use gbl_message
  use gbl_interfaces
  ! Make an incorrect call according to the interface:
  call gagout(seve%e,'Some string')
end program test


$ gfortran -v
Using built-in specs.
COLLECT_GCC=gfortran
Target: x86_64-unknown-linux-gnu
Configured with: ./configure --with-gmp=... --prefix=...
--enable-languages=c,c++,fortran
Thread model: posix
gcc version 4.9.0 (GCC)


$ gfortran test.f90
test.f90:17.6:

  use gbl_message
      1
Error: Type mismatch in argument 'message' at (1); passed INTEGER(4) to
CHARACTER(1)


You can see that the error message refers to the USE statement instead of the
CALL statement. If I change the line
  call gagout(seve%e,'Some string')
by
  call gagout(1,'Some string')
the error message is now correct.

Sebastien


             reply	other threads:[~2014-06-03 16:03 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-06-03 16:03 bardeau at iram dot fr [this message]
2014-06-03 22:41 ` [Bug fortran/61404] " dominiq at lps dot ens.fr

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bug-61404-4@http.gcc.gnu.org/bugzilla/ \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).