public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/38220]  New: C_LOC intrinsic non-pure and without explicit interface
@ 2008-11-21 22:03 dfranke at gcc dot gnu dot org
  2008-12-09 20:31 ` [Bug fortran/38220] " dfranke at gcc dot gnu dot org
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: dfranke at gcc dot gnu dot org @ 2008-11-21 22:03 UTC (permalink / raw)
  To: gcc-bugs

$> cat cloc.f90
USE ISO_C_BINDING, ONLY: C_PTR, C_LOC
CONTAINS
  PURE SUBROUTINE F(x)
    INTEGER, INTENT(in), TARGET :: x
    TYPE(C_PTR) :: px
    px = C_LOC(x)
  END SUBROUTINE
END

$> gfortran-svn -Wimplicit-interface cloc.f90
cloc.f90:6.9:

    px = C_LOC(x)
        1
Warning: Procedure 'c_loc' called with an implicit interface at (1)
cloc.f90:6.9:

    px = C_LOC(x)
        1
Error: Function reference to 'c_loc' at (1) is to a non-PURE procedure within a
PURE procedure

$> gfortran-svn --version
GNU Fortran (GCC) 4.4.0 20081120 (experimental)


To my knowledge, all intrinsics have an explicit interface and are PURE by
default?!


-- 
           Summary: C_LOC intrinsic non-pure and without explicit interface
           Product: gcc
           Version: 4.4.0
            Status: UNCONFIRMED
          Keywords: rejects-valid
          Severity: normal
          Priority: P3
         Component: fortran
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: dfranke at gcc dot gnu dot org
OtherBugsDependingO 20585,32630
             nThis:


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


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

* [Bug fortran/38220] C_LOC intrinsic non-pure and without explicit interface
  2008-11-21 22:03 [Bug fortran/38220] New: C_LOC intrinsic non-pure and without explicit interface dfranke at gcc dot gnu dot org
@ 2008-12-09 20:31 ` dfranke at gcc dot gnu dot org
  2008-12-09 20:51 ` dfranke at gcc dot gnu dot org
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: dfranke at gcc dot gnu dot org @ 2008-12-09 20:31 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #1 from dfranke at gcc dot gnu dot org  2008-12-09 20:30 -------
The same seems to hold for C_FUNLOC, but not C_F_POINTER?!


-- 


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


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

* [Bug fortran/38220] C_LOC intrinsic non-pure and without explicit interface
  2008-11-21 22:03 [Bug fortran/38220] New: C_LOC intrinsic non-pure and without explicit interface dfranke at gcc dot gnu dot org
  2008-12-09 20:31 ` [Bug fortran/38220] " dfranke at gcc dot gnu dot org
@ 2008-12-09 20:51 ` dfranke at gcc dot gnu dot org
  2009-01-06 13:06 ` tkoenig at gcc dot gnu dot org
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: dfranke at gcc dot gnu dot org @ 2008-12-09 20:51 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #2 from dfranke at gcc dot gnu dot org  2008-12-09 20:49 -------
symbol.c (generate_isocbinding_symbol):
....
4139  /* Here, we're taking the simple approach.  We're defining
4140     c_loc as an external identifier so the compiler will put
4141     what we expect on the stack for the address we want the
4142     C address of.  */
....
4170  tmp_sym->attr.external = 1;
4171  tmp_sym->attr.if_source = IFSRC_UNKNOWN;
....


-- 


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


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

* [Bug fortran/38220] C_LOC intrinsic non-pure and without explicit interface
  2008-11-21 22:03 [Bug fortran/38220] New: C_LOC intrinsic non-pure and without explicit interface dfranke at gcc dot gnu dot org
  2008-12-09 20:31 ` [Bug fortran/38220] " dfranke at gcc dot gnu dot org
  2008-12-09 20:51 ` dfranke at gcc dot gnu dot org
@ 2009-01-06 13:06 ` tkoenig at gcc dot gnu dot org
  2009-01-06 23:03 ` tkoenig at gcc dot gnu dot org
  2009-01-06 23:05 ` tkoenig at gcc dot gnu dot org
  4 siblings, 0 replies; 6+ messages in thread
From: tkoenig at gcc dot gnu dot org @ 2009-01-06 13:06 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #3 from tkoenig at gcc dot gnu dot org  2009-01-06 13:05 -------
This appears to resolve the issue(s):

Index: interface.c
===================================================================
--- interface.c (revision 143076)
+++ interface.c (working copy)
@@ -2411,9 +2411,12 @@ void
 gfc_procedure_use (gfc_symbol *sym, gfc_actual_arglist **ap, locus *where)
 {

-  /* Warn about calls with an implicit interface.  */
+  /* Warn about calls with an implicit interface.  Special case
+     for calling a ISO_C_BINDING because these c_loc and c_funloc
+     are pseudo-unknown.  */
   if (gfc_option.warn_implicit_interface
-      && sym->attr.if_source == IFSRC_UNKNOWN)
+      && sym->attr.if_source == IFSRC_UNKNOWN
+      && ! sym->attr.is_iso_c)
     gfc_warning ("Procedure '%s' called with an implicit interface at %L",
                 sym->name, where);

Index: symbol.c
===================================================================
--- symbol.c    (revision 143076)
+++ symbol.c    (working copy)
@@ -4169,6 +4169,7 @@ generate_isocbinding_symbol (const char
                tmp_sym->result = tmp_sym;
                tmp_sym->attr.external = 1;
                tmp_sym->attr.use_assoc = 0;
+               tmp_sym->attr.pure = 1;
                tmp_sym->attr.if_source = IFSRC_UNKNOWN;
                tmp_sym->attr.proc = PROC_UNKNOWN;
              }


-- 

tkoenig at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         AssignedTo|unassigned at gcc dot gnu   |tkoenig at gcc dot gnu dot
                   |dot org                     |org
             Status|UNCONFIRMED                 |ASSIGNED
     Ever Confirmed|0                           |1
   Last reconfirmed|0000-00-00 00:00:00         |2009-01-06 13:05:59
               date|                            |


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


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

* [Bug fortran/38220] C_LOC intrinsic non-pure and without explicit interface
  2008-11-21 22:03 [Bug fortran/38220] New: C_LOC intrinsic non-pure and without explicit interface dfranke at gcc dot gnu dot org
                   ` (2 preceding siblings ...)
  2009-01-06 13:06 ` tkoenig at gcc dot gnu dot org
@ 2009-01-06 23:03 ` tkoenig at gcc dot gnu dot org
  2009-01-06 23:05 ` tkoenig at gcc dot gnu dot org
  4 siblings, 0 replies; 6+ messages in thread
From: tkoenig at gcc dot gnu dot org @ 2009-01-06 23:03 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #4 from tkoenig at gcc dot gnu dot org  2009-01-06 23:03 -------
Subject: Bug 38220

Author: tkoenig
Date: Tue Jan  6 23:03:18 2009
New Revision: 143140

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=143140
Log:
2009-01-06  Thomas Koenig  <tkoenig@gcc.gnu.org>

        PR fortran/38220
        * interface.c (gfc_procedure_use):  Don't warn about functions
        from ISO_C_BINDING.
        * symbol.c (generate_isocbinding_symbol):  Mark c_loc and
        c_funloc as pure.

2009-01-06  Thomas Koenig  <tkoenig@gcc.gnu.org>

        PR fortran/38220
        * gfortran.dg/c_loc_pure_1.f90:  New test.


Added:
    trunk/gcc/testsuite/gfortran.dg/c_loc_pure_1.f90
Modified:
    trunk/gcc/fortran/ChangeLog
    trunk/gcc/fortran/interface.c
    trunk/gcc/fortran/symbol.c
    trunk/gcc/testsuite/ChangeLog


-- 


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


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

* [Bug fortran/38220] C_LOC intrinsic non-pure and without explicit interface
  2008-11-21 22:03 [Bug fortran/38220] New: C_LOC intrinsic non-pure and without explicit interface dfranke at gcc dot gnu dot org
                   ` (3 preceding siblings ...)
  2009-01-06 23:03 ` tkoenig at gcc dot gnu dot org
@ 2009-01-06 23:05 ` tkoenig at gcc dot gnu dot org
  4 siblings, 0 replies; 6+ messages in thread
From: tkoenig at gcc dot gnu dot org @ 2009-01-06 23:05 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #5 from tkoenig at gcc dot gnu dot org  2009-01-06 23:05 -------
Fixed on trunk, closing.


-- 

tkoenig at gcc dot gnu dot org changed:

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


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


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

end of thread, other threads:[~2009-01-06 23:05 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-11-21 22:03 [Bug fortran/38220] New: C_LOC intrinsic non-pure and without explicit interface dfranke at gcc dot gnu dot org
2008-12-09 20:31 ` [Bug fortran/38220] " dfranke at gcc dot gnu dot org
2008-12-09 20:51 ` dfranke at gcc dot gnu dot org
2009-01-06 13:06 ` tkoenig at gcc dot gnu dot org
2009-01-06 23:03 ` tkoenig at gcc dot gnu dot org
2009-01-06 23:05 ` tkoenig at gcc dot gnu dot 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).