Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

sizeof pointer to derive type #1020

Open
naromero77 opened this issue Feb 24, 2020 · 4 comments
Open

sizeof pointer to derive type #1020

naromero77 opened this issue Feb 24, 2020 · 4 comments

Comments

@naromero77
Copy link

This compile-time error comes from a DOE science code. I suspect the problem is triggered by the intrinsic sizeof function operating on a pointer to a derived type.

home/naromero/mpich-3.3.2-test/bin/mpif90 -g -O3 -module-suffix .f18.mod  -fPIC -I/usr/include -D LIBRARY=1  -D  FFTW=1 -c -o src/parallelization/tiling/tiling.o src/parallelization/tiling/tiling.F90
src/parallelization/tiling/tiling.F90:1992:57: error: No explicit type declared for 'sizeof'

Here is the ling that it chokes on:

              local_part_tiles_mem=local_part_tiles_mem+SIZEOF(curr%part_x) 

and here is the declaration for the arguement:

    TYPE(particle_tile), POINTER :: curr

I am packaging up tiling.F90 along with the relevant modules.
sizeof_type_pointer.tar.gz

@klausler
Copy link
Collaborator

Fortran doesn't have an intrinsic function named sizeof.

That call looks suspiciously like a macro invocation.

@sscalpone
Copy link
Member

Intel and Gnu have a sizeof intrinsic.

https://software.intel.com/en-us/fortran-compiler-developer-guide-and-reference-sizeof

https://gcc.gnu.org/onlinedocs/gfortran/SIZEOF.html

Has this been standardized as C_SIZEOF?

@naromero77
Copy link
Author

Yep, those where the pages that I found. It seemed very much a C thing that got transplanted into Fortran.

This code is usually compiled with GNU or Intel.

@naromero77
Copy link
Author

Best that I can tell, there does not seem to be a macro defined in the code.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants