Bug 34871 - Flavor VARIABLE vs. FUNCTION: Accepts invalid
Summary: Flavor VARIABLE vs. FUNCTION: Accepts invalid
Status: NEW
Alias: None
Product: gcc
Classification: Unclassified
Component: fortran (show other bugs)
Version: 4.3.0
: P3 normal
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL:
Keywords: accepts-invalid
Depends on:
Blocks:
 
Reported: 2008-01-19 11:59 UTC by Tobias Burnus
Modified: 2019-01-25 21:14 UTC (History)
4 users (show)

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed: 2017-06-15 00:00:00


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Tobias Burnus 2008-01-19 11:59:29 UTC
MODULE TESTS
       dimension :: k(4)
     CONTAINS
     function k()
       k = 35
     end function k
     END MODULE

is invalid (variable "k" vs. function "k"), but not detected.

Needs to be fixed in decl.c's get_proc_name; I have a patch, but it causes regressions
Comment 1 Daniel Franke 2008-01-21 22:11:49 UTC
There are multiple issues with function names, i.e. where a function symbol is picked up which shouldn't. See PR34714 for another example.
Comment 2 Daniel Franke 2008-01-21 23:23:22 UTC
And Pr34910.
Comment 3 Paul Thomas 2008-11-18 19:35:34 UTC
Yes indeed - confirmed.

Paul
Comment 4 Thomas Koenig 2017-06-15 10:22:15 UTC
Still current on trunk.
Comment 5 Harald Anlauf 2019-01-25 21:14:41 UTC
If the example in comment #0 is changed as follows:

MODULE TESTS
  dimension :: k(4)
CONTAINS
  function k() result (kk)
    kk = 35
  end function k
END MODULE TESTS

the code - although still invalid - still compiles, but the dump-tree
is completely different.

I also see big differences in the dump-tree between comment #0 and the
above for 9-trunk, but not for 8-branch.

ISTR a patch (Steve) that fixed a related issue with RESULT(), maybe
that is the place to look for a fix?