public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/32804]  New: ISO C Binding: C_LOC argument checking needs improvement
@ 2007-07-18  7:47 burnus at gcc dot gnu dot org
  2007-07-19  8:31 ` [Bug fortran/32804] " burnus at gcc dot gnu dot org
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: burnus at gcc dot gnu dot org @ 2007-07-18  7:47 UTC (permalink / raw)
  To: gcc-bugs

subroutine aaa(in)
      use iso_c_binding
      implicit none
      CHARACTER(KIND=C_CHAR), DIMENSION(*), TARGET  :: in
      type(c_ptr) :: cptr
      cptr = c_loc(in)
      end subroutine

Wrongly rejected with:
  Error: CHARACTER argument 'in' to 'c_loc' at (1) must have a length of 1

      subroutine aaa(in)
      use iso_c_binding
      implicit none
      integer(KIND=C_int), DIMENSION(:), TARGET  :: in
      type(c_ptr) :: cptr
      cptr = c_loc(in)
      end subroutine

Wrongly accepts this; NAG f95 writes:

Error: aa.f90, line 6: The argument to C_LOC must not be an assumed-shape array


-- 
           Summary: ISO C Binding: C_LOC argument checking needs improvement
           Product: gcc
           Version: 4.3.0
            Status: UNCONFIRMED
          Keywords: rejects-valid, accepts-invalid
          Severity: normal
          Priority: P3
         Component: fortran
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: burnus at gcc dot gnu dot org
OtherBugsDependingO 32630
             nThis:


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


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

* [Bug fortran/32804] ISO C Binding: C_LOC argument checking needs improvement
  2007-07-18  7:47 [Bug fortran/32804] New: ISO C Binding: C_LOC argument checking needs improvement burnus at gcc dot gnu dot org
@ 2007-07-19  8:31 ` burnus at gcc dot gnu dot org
  2007-07-19 19:15 ` patchapp at dberlin dot org
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: burnus at gcc dot gnu dot org @ 2007-07-19  8:31 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #1 from burnus at gcc dot gnu dot org  2007-07-19 08:30 -------
For the accept-invalid part (c_loc of an assumed-shape array). The standard
says:
"X shall either
 (1) have interoperable type and type parameters and be
   (a) a variable that has the TARGET attribute and is interoperable,"

This variable has the TARGET attribute, but is not interoperable:
"An array Fortran variable is interoperable if its type and type parameters are
interoperable and it is of explicit shape or assumed size."

Thus this error by NAG f95 is ok; however, as it is accepted by ifort, g95 and
(currently) gfortran. As I completely fail to see any valid use of it and see
several cases where it seems to work but one uses in reality the wrong array
element, I favour to not allowing it even for -std=gnu. But if one finds a
valid use, I'm also fine with an error only for -std=f2003.


-- 


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


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

* [Bug fortran/32804] ISO C Binding: C_LOC argument checking needs improvement
  2007-07-18  7:47 [Bug fortran/32804] New: ISO C Binding: C_LOC argument checking needs improvement burnus at gcc dot gnu dot org
  2007-07-19  8:31 ` [Bug fortran/32804] " burnus at gcc dot gnu dot org
@ 2007-07-19 19:15 ` patchapp at dberlin dot org
  2007-07-21 20:31 ` kargl at gcc dot gnu dot org
  2007-07-21 20:37 ` kargl at gcc dot gnu dot org
  3 siblings, 0 replies; 5+ messages in thread
From: patchapp at dberlin dot org @ 2007-07-19 19:15 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #2 from patchapp at dberlin dot org  2007-07-19 19:15 -------
Subject: Bug number PR 32804

A patch for this bug has been added to the patch tracker.
The mailing list url for the patch is
http://gcc.gnu.org/ml/gcc-patches/2007-07/msg01577.html


-- 


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


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

* [Bug fortran/32804] ISO C Binding: C_LOC argument checking needs improvement
  2007-07-18  7:47 [Bug fortran/32804] New: ISO C Binding: C_LOC argument checking needs improvement burnus at gcc dot gnu dot org
  2007-07-19  8:31 ` [Bug fortran/32804] " burnus at gcc dot gnu dot org
  2007-07-19 19:15 ` patchapp at dberlin dot org
@ 2007-07-21 20:31 ` kargl at gcc dot gnu dot org
  2007-07-21 20:37 ` kargl at gcc dot gnu dot org
  3 siblings, 0 replies; 5+ messages in thread
From: kargl at gcc dot gnu dot org @ 2007-07-21 20:31 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #3 from kargl at gcc dot gnu dot org  2007-07-21 20:31 -------
Subject: Bug 32804

Author: kargl
Date: Sat Jul 21 20:31:17 2007
New Revision: 126812

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=126812
Log:
2007-07-21  Christopher D. Rickett  <crickett@lanl.gov>

        PR fortran/32801
        * symbol.c (generate_isocbinding_symbol): Remove unnecessary
        conditional.

        PR fortran/32804
        * resolve.c (gfc_iso_c_func_interface): Reject assumed-shape and
        deferred-shape arrays as args to C_LOC.  Fix bug in testing
        character args to C_LOC.

2007-07-21  Christopher D. Rickett  <crickett@lanl.gov>

        PR fortran/32804
        * gfortran.dg/c_loc_tests_9.f03: New test case.
        * gfortran.dg/c_loc_tests_10.f03: Ditto.


Added:
    trunk/gcc/testsuite/gfortran.dg/c_loc_tests_10.f03
    trunk/gcc/testsuite/gfortran.dg/c_loc_tests_9.f03
Modified:
    trunk/gcc/fortran/ChangeLog
    trunk/gcc/fortran/resolve.c
    trunk/gcc/fortran/symbol.c
    trunk/gcc/testsuite/ChangeLog


-- 


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


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

* [Bug fortran/32804] ISO C Binding: C_LOC argument checking needs improvement
  2007-07-18  7:47 [Bug fortran/32804] New: ISO C Binding: C_LOC argument checking needs improvement burnus at gcc dot gnu dot org
                   ` (2 preceding siblings ...)
  2007-07-21 20:31 ` kargl at gcc dot gnu dot org
@ 2007-07-21 20:37 ` kargl at gcc dot gnu dot org
  3 siblings, 0 replies; 5+ messages in thread
From: kargl at gcc dot gnu dot org @ 2007-07-21 20:37 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #4 from kargl at gcc dot gnu dot org  2007-07-21 20:36 -------
Fixed on trunk.


-- 

kargl at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
         Resolution|                            |FIXED
   Target Milestone|---                         |4.3.0


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


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

end of thread, other threads:[~2007-07-21 20:37 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-07-18  7:47 [Bug fortran/32804] New: ISO C Binding: C_LOC argument checking needs improvement burnus at gcc dot gnu dot org
2007-07-19  8:31 ` [Bug fortran/32804] " burnus at gcc dot gnu dot org
2007-07-19 19:15 ` patchapp at dberlin dot org
2007-07-21 20:31 ` kargl at gcc dot gnu dot org
2007-07-21 20:37 ` kargl 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).