public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/40920]  New: Derived type with BIND(C) - rejected as argument.
@ 2009-07-30 21:33 burnus at gcc dot gnu dot org
  2009-08-03  9:53 ` [Bug fortran/40920] " burnus at gcc dot gnu dot org
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: burnus at gcc dot gnu dot org @ 2009-07-30 21:33 UTC (permalink / raw)
  To: gcc-bugs

Found at
http://groups.google.com/group/comp.lang.fortran/browse_thread/thread/220286db98888bb4#

The following program is rejected with the bogus message that the derived type
is not interoperable - it works if one moves the type declaration out of the
interface statement. It also works with SEQUENCE instead of BIND(C).


                RESULTAT, SIGNE) bind(C, name='gsl_sf_lngamma_sgn_e_wrapper')
                        1
Error: Type 'resultat' at (1) is a parameter to the BIND(C)  procedure
'gsl_sf_lngamma_sgn_e_wrapper' but is not C interoperable because
derived type 'gsl_sf_result' is not C interoperable.


!            use iso_c_binding
!            type, bind(C) :: GSL_SF_RESULT
!                real(c_double)          VALEUR
!                real(c_double)          ERREUR
!            end type
    interface
        integer(c_int) function gsl_sf_lngamma_sgn_e_wrapper(X, &
                RESULTAT, SIGNE) bind(C, name='gsl_sf_lngamma_sgn_e_wrapper')
            use iso_c_binding
!            import :: GSL_SF_RESULT
            implicit none
            type, bind(C) :: GSL_SF_RESULT
                real(c_double)          VALEUR
                real(c_double)          ERREUR
            end type
            real(c_double), intent(in) ::               X
            type(GSL_SF_RESULT), intent(out) ::         RESULTAT
            real(c_double), intent(out) ::              SIGNE
        end function
    end interface
    end


-- 
           Summary: Derived type with BIND(C) - rejected as argument.
           Product: gcc
           Version: 4.5.0
            Status: UNCONFIRMED
          Keywords: rejects-valid
          Severity: normal
          Priority: P3
         Component: fortran
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: burnus at gcc dot gnu dot org


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


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

* [Bug fortran/40920] Derived type with BIND(C) - rejected as argument.
  2009-07-30 21:33 [Bug fortran/40920] New: Derived type with BIND(C) - rejected as argument burnus at gcc dot gnu dot org
@ 2009-08-03  9:53 ` burnus at gcc dot gnu dot org
  2010-01-13  0:44 ` kargl at gcc dot gnu dot org
  2010-01-13  8:45 ` burnus at gcc dot gnu dot org
  2 siblings, 0 replies; 4+ messages in thread
From: burnus at gcc dot gnu dot org @ 2009-08-03  9:53 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #1 from burnus at gcc dot gnu dot org  2009-08-03 09:53 -------
Could not find the problem so far, cf. symbol.c's verify_bind_c_derived_type as
starting point.

 * * *

The following TODO should be checked; I heard it is invalid C99 (as per grammar
in 6.7.2.1 Structure and union specifiers) but valid C++. One should check it
in the F2003 (F2008 draft?) as this the definite source.

  /* TODO: is this really an error?  */
  if (curr_comp == NULL)
    {
      gfc_error ("Derived type '%s' at %L is empty",
                 derived_sym->name, &(derived_sym->declared_at));
      return FAILURE;
    }


-- 


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


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

* [Bug fortran/40920] Derived type with BIND(C) - rejected as argument.
  2009-07-30 21:33 [Bug fortran/40920] New: Derived type with BIND(C) - rejected as argument burnus at gcc dot gnu dot org
  2009-08-03  9:53 ` [Bug fortran/40920] " burnus at gcc dot gnu dot org
@ 2010-01-13  0:44 ` kargl at gcc dot gnu dot org
  2010-01-13  8:45 ` burnus at gcc dot gnu dot org
  2 siblings, 0 replies; 4+ messages in thread
From: kargl at gcc dot gnu dot org @ 2010-01-13  0:44 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #2 from kargl at gcc dot gnu dot org  2010-01-13 00:43 -------
A related issue has been reported here

http://groups.google.com/group/comp.lang.fortran/browse_frm/thread
/ddc211f2987326b8#

in particular the error message needs to be rewritten.

Error: Type 'resultat' at (1) is a parameter to the BIND(C)  procedure
'gsl_sf_lngamma_sgn_e_wrapper' but is not C interoperable because
derived type 'gsl_sf_result' is not C interoperable.

resultat is not a type, and it most definitely is not a parameter.

Possible wording

Error:  Argument 'resultat' at (1) to the BIND(C) procedure
'gsl_sf_lngamma_sgn_e_wrapper' is not ...


-- 


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


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

* [Bug fortran/40920] Derived type with BIND(C) - rejected as argument.
  2009-07-30 21:33 [Bug fortran/40920] New: Derived type with BIND(C) - rejected as argument burnus at gcc dot gnu dot org
  2009-08-03  9:53 ` [Bug fortran/40920] " burnus at gcc dot gnu dot org
  2010-01-13  0:44 ` kargl at gcc dot gnu dot org
@ 2010-01-13  8:45 ` burnus at gcc dot gnu dot org
  2 siblings, 0 replies; 4+ messages in thread
From: burnus at gcc dot gnu dot org @ 2010-01-13  8:45 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #3 from burnus at gcc dot gnu dot org  2010-01-13 08:44 -------
(In reply to comment #2)
> A related issue has been reported here
> http://groups.google.com/group/comp.lang.fortran/browse_frm/thread/ddc211f2987326b8#

That example is invalid and correctly rejected; if one makes it valid, one is
back at the bug shown in comment 0. But I agree that the message text is bad:

--- decl.c      (revision 155850)
+++ decl.c      (working copy)
@@ -936,2 +936,2 @@ verify_c_interop_param (gfc_symbol *sym)
-               gfc_error ("Type '%s' at %L is a parameter to the BIND(C) "
-                          " procedure '%s' but is not C interoperable "
+               gfc_error ("Dummy argument '%s' at %L of BIND(C) "
+                          "procedure '%s' is not C interoperable "

(Your "Argument .. to procedure" sounds for me as if an "actual argument" were
meant.)


-- 


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


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

end of thread, other threads:[~2010-01-13  8:45 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-07-30 21:33 [Bug fortran/40920] New: Derived type with BIND(C) - rejected as argument burnus at gcc dot gnu dot org
2009-08-03  9:53 ` [Bug fortran/40920] " burnus at gcc dot gnu dot org
2010-01-13  0:44 ` kargl at gcc dot gnu dot org
2010-01-13  8:45 ` burnus 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).