Bug 24633 - MODULE attribute conflicts with PROCEDURE attribute
Summary: MODULE attribute conflicts with PROCEDURE attribute
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: fortran (show other bugs)
Version: 4.1.0
: P3 enhancement
Target Milestone: 4.3.0
Assignee: Not yet assigned to anyone
URL: http://gcc.gnu.org/ml/gcc-patches/200...
Keywords: diagnostic
Depends on:
Blocks:
 
Reported: 2005-11-02 10:57 UTC by Pierre-Matthieu Anglade
Modified: 2007-05-18 14:27 UTC (History)
3 users (show)

See Also:
Host:
Target:
Build:
Known to work: 4.3.0
Known to fail: 4.1.2 4.2.0
Last reconfirmed: 2006-01-29 19:47:03


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Pierre-Matthieu Anglade 2005-11-02 10:57:57 UTC
"MODULE attribute conflicts with PROCEDURE attribute" 
this error message is not accurate enough.
The conflicting attribute should be mentionned.

For instance in:

module abc
contain
function abc()
....

The conflicting attributes is the name of the module and the name of the function.

this is valid for:
  GNU Fortran 95 (GCC) 4.1.0 20051015 (experimental)
  Copyright (C) 2005 Free Software Foundation, Inc.
on
  Linux descartes 2.6.13-1.1526_FC4smp #1 SMP Wed Sep 28 19:28:24 EDT 2005  x86_64 x86_64 x86_64 GNU/Linux
Comment 1 Andrew Pinski 2005-11-02 13:15:31 UTC
Full testcase:
module abc
contains
function abc()
i=1
end function
end module


There is actually two problems here, the first is the message about the conflicts is not very clear.  The second issue is that the error recovery is not really good in that we don't really enter a function scope (sorry I am using C terms, I don't know a better way of describing the issue).
Comment 2 Pierre-Matthieu Anglade 2005-11-02 13:28:43 UTC
(In reply to comment #1)
> Full testcase:
> module abc
> contains
> function abc()
> i=1
> end function
> end module
> 
> 
> There is actually two problems here, the first is the message about the
> conflicts is not very clear.  The second issue is that the error recovery is
> not really good in that we don't really enter a function scope (sorry I am
> using C terms, I don't know a better way of describing the issue).
> 


Sorry for being unclear.
1) The error in the test case is that the function and the module have the same name. 
2) The problem with gfortran is not that it does any mistake. It's just that the output error message is not clear enough. 
3) sorry for not having put a "complete" dummy test case. here it is
module abc
contains
function abc(i)
integer::i,abc
abc=i
end function abc
end module abc
Comment 3 Daniel Franke 2007-04-30 01:11:39 UTC
Pierre, using your example from comment #2, would you consider

subroutine abc()
             1
Error: MODULE attribute of 'abc' conflicts with PROCEDURE attribute at (1)
                        ^^^^^^^^

an improvement, or is something else wrong with this message? 
Comment 4 Pierre-Matthieu Anglade 2007-04-30 07:37:12 UTC
> 
> subroutine abc()
>              1
> Error: MODULE attribute of 'abc' conflicts with PROCEDURE attribute at (1)

Hi,

Yes this is already much more clear. Yet I wonder if "MODULE attribute of 'abc'" could be changed into something like """Module denomination attribute (='abc') ..."""

regards

PMA 
Comment 5 Daniel Franke 2007-04-30 12:05:04 UTC
The message text is not hardcoded and used to report multiple kinds of clashes, thus its genericity. Adding the name is easy, special-casing it for any combination of clashing is, IMO, not a viable option.
Comment 6 Daniel Franke 2007-05-18 14:25:31 UTC
Subject: Bug 24633

Author: dfranke
Date: Fri May 18 13:25:07 2007
New Revision: 124828

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=124828
Log:
2007-05-18  Daniel Franke  <franke.daniel@gmail.com>

        PR fortran/24633
        * symbol.c (gfc_add_flavor): Add the NAME to error message if
        available.


Modified:
    trunk/gcc/fortran/ChangeLog
    trunk/gcc/fortran/symbol.c

Comment 7 Daniel Franke 2007-05-18 14:27:29 UTC
Fixed in trunk, the changes will not be backported to 4.2. 
Closing.