https://gcc.gnu.org/bugzilla/show_bug.cgi?id=84591

--- Comment #6 from kargls at comcast dot net ---
(In reply to anlauf from comment #5)
> (In reply to kargls from comment #4)
> > (In reply to Thomas Koenig from comment #3)
> > > Resolve as invalid?
> > 
> > IMHO.  Yes.
> > 
> > IMNSHO, -fdefault-integer-8 should have been removed from 
> > gfortran years ago.  I even submitted a patch to do so,
> > which was rejected.  Codes in the testsuite are meant to
> > test a patch fixes a real issue.  Running the testsuite
> > with -fdefault-integer-8 is simply going to run into
> > issues with BIND(C).
> 
> Careful.  The -fdefault-integer-8 is just a tip of a difference iceberg.

Well, I disagree.  -fdefault-integer-8 should have been removed.
If one thinks they needs that option, then they likely are looking
for -finteger-4-integer-8.

> Omit this option, and replace c_int by c_long.  You'll then get:
> 
> bind_c_usage_10.f03:45:32:
> 
>    45 |   integer(c_long) function func1() bind(c, name="myFunc1")
>       |                                1
> Error: FUNCTION result func1 cannot be of type INTEGER(8) in FUNCTION func1
> at (1)
> 
> This is a resolution bug in gfortran, and there is IIRC sort of a duplicate.

Different bug(?)

See comment #2 on why -fdefault-integer-8 simply cannot work with BIND(C).
Blindly applying -fdefault-integer-8 across the entire testsuite is a
rather interesting exercise (where I'm being polite here).

As to the above error, if you remove the ENTRY statement and following
code, it compiles without error.  

   module mod
     use iso_c_binding
     implicit none
     contains
     integer(c_long) function func1() bind(c, name="myFunc1")
       real(c_float) :: func1ent
       func1 = -5  ! Note, type conversion occurs here
       return
   !   entry func1ent()
          func1ent = -55.0
      end function func1
   end module mod

I don't use entry and would need to check the requirement that
BIND(C) place on it.

Reply via email to