public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/45190]  New: Compile-time error on valid code: can't convert TYPE(_gfortran_iso_c_binding_c_ptr) to TYPE(c_ptr)
@ 2010-08-05  7:51 mathewc at nag dot co dot uk
  2010-08-05 15:46 ` [Bug fortran/45190] " kargl at gcc dot gnu dot org
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: mathewc at nag dot co dot uk @ 2010-08-05  7:51 UTC (permalink / raw)
  To: gcc-bugs

> gfortran --version
GNU Fortran (GCC) 4.5.1

> uname -a
Linux tiree.nag.co.uk 2.6.27.25-170.2.72.fc10.x86_64 #1 SMP Sun Jun 21 18:39:34
EDT 2009 x86_64 x86_64 x86_64 GNU/Linux

> cat cfpointerstress.f90
MODULE NAG_J_TYPES
  USE ISO_C_BINDING, ONLY : C_PTR
  IMPLICIT NONE
  TYPE                            :: NAG_IMAGE
     INTEGER                      :: WIDTH, HEIGHT, PXFMT, NCHAN
     TYPE (C_PTR)                 :: PIXELS
  END TYPE NAG_IMAGE
END MODULE NAG_J_TYPES
program cfpointerstress
  use nag_j_types
  use iso_c_binding
  implicit none
  type(nag_image),pointer :: img
  type(C_PTR)             :: ptr
  real, pointer           :: r
  allocate(r)
  allocate(img)
  r = 12
  ptr = c_loc(img)
  write(*,*) 'C_ASSOCIATED =', C_ASSOCIATED(ptr)
  call c_f_pointer(ptr, img)
  write(*,*) 'ASSOCIATED =', associated(img)
  deallocate(r)
end program cfpointerstress

> gfortran cfpointerstress.f90
cfpointerstress.f90:19.8:

  ptr = c_loc(img)
        1
Error: Can't convert TYPE(_gfortran_iso_c_binding_c_ptr) to TYPE(c_ptr) at (1)


-- 
           Summary: Compile-time error on valid code: can't convert
                    TYPE(_gfortran_iso_c_binding_c_ptr) to TYPE(c_ptr)
           Product: gcc
           Version: 4.5.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: fortran
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: mathewc at nag dot co dot uk


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


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

* [Bug fortran/45190] Compile-time error on valid code: can't convert TYPE(_gfortran_iso_c_binding_c_ptr) to TYPE(c_ptr)
  2010-08-05  7:51 [Bug fortran/45190] New: Compile-time error on valid code: can't convert TYPE(_gfortran_iso_c_binding_c_ptr) to TYPE(c_ptr) mathewc at nag dot co dot uk
@ 2010-08-05 15:46 ` kargl at gcc dot gnu dot org
  2010-08-05 16:03 ` dominiq at lps dot ens dot fr
  2010-08-05 17:51 ` mikael at gcc dot gnu dot org
  2 siblings, 0 replies; 4+ messages in thread
From: kargl at gcc dot gnu dot org @ 2010-08-05 15:46 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #1 from kargl at gcc dot gnu dot org  2010-08-05 15:46 -------
The problem also occurs with 4.6.0.

Note, if you remove the ', only : c_ptr' in NAG_J_TYPES,
the code compiles and produces 

laptop:kargl[214] gfc4x -o z tr.f90
laptop:kargl[215] ./z
 C_ASSOCIATED = T
 ASSOCIATED = T

So, there appears to be a problem with using an ONLY clause
with ISO C binding.


-- 

kargl at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
     Ever Confirmed|0                           |1
   Last reconfirmed|0000-00-00 00:00:00         |2010-08-05 15:46:24
               date|                            |


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


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

* [Bug fortran/45190] Compile-time error on valid code: can't convert TYPE(_gfortran_iso_c_binding_c_ptr) to TYPE(c_ptr)
  2010-08-05  7:51 [Bug fortran/45190] New: Compile-time error on valid code: can't convert TYPE(_gfortran_iso_c_binding_c_ptr) to TYPE(c_ptr) mathewc at nag dot co dot uk
  2010-08-05 15:46 ` [Bug fortran/45190] " kargl at gcc dot gnu dot org
@ 2010-08-05 16:03 ` dominiq at lps dot ens dot fr
  2010-08-05 17:51 ` mikael at gcc dot gnu dot org
  2 siblings, 0 replies; 4+ messages in thread
From: dominiq at lps dot ens dot fr @ 2010-08-05 16:03 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #2 from dominiq at lps dot ens dot fr  2010-08-05 16:03 -------
> The problem also occurs with 4.6.0.

As well as with 4.4.4.

Note that an other pr related to the use of ONLY (pr44702) has been fixed by
Tobias Burnus: I CCed him.


-- 

dominiq at lps dot ens dot fr changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |burnus at gcc dot gnu dot
                   |                            |org


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


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

* [Bug fortran/45190] Compile-time error on valid code: can't convert TYPE(_gfortran_iso_c_binding_c_ptr) to TYPE(c_ptr)
  2010-08-05  7:51 [Bug fortran/45190] New: Compile-time error on valid code: can't convert TYPE(_gfortran_iso_c_binding_c_ptr) to TYPE(c_ptr) mathewc at nag dot co dot uk
  2010-08-05 15:46 ` [Bug fortran/45190] " kargl at gcc dot gnu dot org
  2010-08-05 16:03 ` dominiq at lps dot ens dot fr
@ 2010-08-05 17:51 ` mikael at gcc dot gnu dot org
  2 siblings, 0 replies; 4+ messages in thread
From: mikael at gcc dot gnu dot org @ 2010-08-05 17:51 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #3 from mikael at gcc dot gnu dot org  2010-08-05 17:51 -------
I think it is the same as pr37829.

*** This bug has been marked as a duplicate of 37829 ***


-- 

mikael at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |DUPLICATE


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


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

end of thread, other threads:[~2010-08-05 17:51 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-08-05  7:51 [Bug fortran/45190] New: Compile-time error on valid code: can't convert TYPE(_gfortran_iso_c_binding_c_ptr) to TYPE(c_ptr) mathewc at nag dot co dot uk
2010-08-05 15:46 ` [Bug fortran/45190] " kargl at gcc dot gnu dot org
2010-08-05 16:03 ` dominiq at lps dot ens dot fr
2010-08-05 17:51 ` mikael 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).