# \-fallow-argument-mismatch

**URL:** <https://fortran-lang.discourse.group/t/fallow-argument-mismatch/4894>\
**Category:** Uncategorized\
**Created:** [December 9, 2022, 8:35am UTC](https://fortran-lang.discourse.group/t/fallow-argument-mismatch/4894 "2022-12-09T08:35:36Z")\
**Posts on this page:** 1\
**Showing post:** 12

<div class="post-metadata">

**Author:** ![FortranFan](https://avatars.discourse-cdn.com/v4/letter/f/96bed5/32.png) [@FortranFan](https://fortran-lang.discourse.group/u/FortranFan)\
**Post date:** [December 10, 2022, 9:26pm UTC](https://fortran-lang.discourse.group/t/fallow-argument-mismatch/4894/12 "2022-12-10T21:26:58Z")

</div>

> [@everythingfunctional](#):
>
> I suspect that’s likely to work, but technically is not standards conforming, as the standard says this:
> 
> > If the value of CPTR is the result of a reference to C\_LOC with a noninter-operable effective argument X, FPTR shall be a nonpolymorphic pointer with the same type and type parameters as X.
> 
> Other than the obsolete `equivalence` I do not believe there is a standards conforming way for a Fortran program to interpret a single section of memory as two different types …

But OP’s use case is toward two different `KIND`s of the same intrinsic type `integer` and here the approach shown by @plevold, provided the reference result provided by `C_LOC` and the `FPTR` are both `integer`s, is alright.

Note this is what I had illustrated earlier in this [**thread**](https://fortran-lang.discourse.group/t/moving-bits-question/4799/9) with a simple container type. OP can pretty much take the container type example with the `bitbucket_t` derived type shown therein and do what is stated in the original post, “To merge the sub records, I am converting the buffer “rec\_data”, which is provided as 4-byte (default) integers to 1-byte integer vector so the sub-records can be easily merged.”

Or, OP can also use `EQUIVALENCE` with “data” stored as a `MODULE` entity and achieve a perfomant solution that way. `EQUIVALENCE`, by the way, is forever going to be part of the standard even if it is labeled as `obsolescent` (a big mistake by the committee on this) in the official publication.

OP can pursue a couple of different standard-conforming options, as stated here, that can work well performance-wise and which can also allow OP to **not** run into the `gfortran` error, “Type mismatch in argument.”

---

_[View the full topic](https://fortran-lang.discourse.group/t/fallow-argument-mismatch/4894)._
