Community
cancel
Showing results for 
Search instead for 
Did you mean: 
ojacquet
Beginner
223 Views

invalid attempt to assign into a pointer that is not associated

Jump to solution

Hello,

Can you have a look on the attached simplified program whose purpose is to highlight an abnormal behaviour when assigning one derived type to another, using the base type they have in common. If I make some change in the program, it becomes normal.

The different behaviours of the program can be reproduced thanks to the preprocessor options added in the program.


With no preprocessor option, the program ends abnormally with the runtime error : forrtl: severe (122): invalid attempt to assign into a pointer that is not associated:

~ > ifort -g -fpp -trace test_derived_type_assignment.f90
~ > ./a.out
before COPY_TYPE1_TO_TYPE2
forrtl: severe (122): invalid attempt to assign into a pointer that is not associated
Image PC Routine Line Source
a.out 0000000000406BC6 Unknown Unknown Unknown
a.out 0000000000403021 types_copy_mp_cop 136 test_derived_type_assignment.f90
a.out 000000000040324C MAIN__ 169 test_derived_type_assignment.f90
a.out 0000000000402AC2 Unknown Unknown Unknown
libc-2.27.so 00007F692F891B97 __libc_start_main Unknown Unknown
a.out 00000000004029AA Unknown Unknown Unknown


Adding assignment overloading makes the program normal:

~ > ifort -g -fpp -D__ASSIGN_OVERL__ -trace test_derived_type_assignment.f90
~ > ./a.out
before COPY_TYPE1_TO_TYPE2
after COPY_TYPE1_TO_TYPE2


Removing the allocatable component of the base type makes the program normal:

~ > ifort -g -fpp -D__REM_ALLOC_COMPO__ -trace test_derived_type_assignment.f90
~ > ./a.out
before COPY_TYPE1_TO_TYPE2
after COPY_TYPE1_TO_TYPE2


Removing the unused routine COPY_TYPE2_TO_TYPE1 from the module TYPES_COPY makes the program normal:

~ > ifort -g -fpp -D__REM_COPY_ROUT__ -trace test_derived_type_assignment.f90
~ > ./a.out
before COPY_TYPE1_TO_TYPE2
after COPY_TYPE1_TO_TYPE2


Merging the modules TYPES and TYPES_COPY makes the program normal:

~ > ifort -g -fpp -D__MODUL_MERGED__ -trace test_derived_type_assignment.f90
~ > ./a.out
before COPY_TYPE1_TO_TYPE2
after COPY_TYPE1_TO_TYPE2


Can you explain me what I'm doing wrong?

Best regards,
Olivier

 

0 Kudos

Accepted Solutions
Steve_Lionel
Black Belt Retired Employee
213 Views

Please try the current compiler and report what it does.

View solution in original post

6 Replies
Steve_Lionel
Black Belt Retired Employee
219 Views

I can't reproduce the error using the oneAPI (2021.1.2) compiler on Windows (I don't have Linux.) Which compiler version are you using?

 
ojacquet
Beginner
217 Views

I use version ifort (IFORT) 19.1.1.217 20200306 on Linux.

Olivier

Steve_Lionel
Black Belt Retired Employee
214 Views

Please try the current compiler and report what it does.

View solution in original post

ojacquet
Beginner
170 Views

Sorry, but I don't have the last version... I cannot afford buying a new licence now...

If anybody can do the test and give the answer, it would be very nice !

Olivier

mecej4
Black Belt
160 Views

The current release of the compiler package (OneAPI) does not need a license fee to be paid or a license file to be installed. You may purchase a support contract if you wish. You may download the portions that you want, using these links.

ojacquet
Beginner
130 Views

Thank you very much for your suggestions !

I have installed the new version of the compiler for free (thanks to Intel too) and it works fine: the anomally has disappeared.

Olivier