Assignment works on 32 Bit Centos but not on 64 Bit RHEL

I have code on two VMWare Virtual Machines. One is a 32 Bit Centos 7 Virtual Machine. The second is a 64 Bit RHEL 7 Virtual Machine. The code runs beautifully on the 32 Bit machine.
I’m having trouble doing a second assignment in C code. In another place within the Fortran 64 Bit code, I removed all but one of several identical consecutive assignments and the segmentation error was removed. What do I do about the below segmentation error? (The second argument in the call to the C routine is an integer, but the C code treats it like a struct pointer!)


[1](RUN TIME OUTPUT) 32 bit Virtual Machine Centos Version 7:
File abc.c function abc_ before assignment MY_ADDRESS =134857380 and my_address = 134857376
File abc.c function abc_ before assignment *MY_ADDRESS =686219592 and my_address->my_value = 10609
File abc.c function abc_ after assignment
File abc.f Calling ABC with Arguments:
File abc.f Calling ABC with MY_ADDRESS = 686219592 and MyInt =
File abc.f 1 MY_ADDRESS + MyInt * 4= 686219596
File abc.c function abc_ before assignment MY_ADDRESS =-1078281524 and my_address = 134742364
File abc.c function abc_ before assignment *MY_ADDRESS =686219596 and my_address->my_value = 0
File abc.c function abc_ after assignment


[2](RUN TIME OUTPUT) 64 bit Virtual Machine RHEL Version 7:
File abc.c function abc_ before assignment MY_ADDRESS =6693860 and my_address = 6693856
File abc.c function abc_ before assignment *MY_ADDRESS =553637392 and my_address->my_value = 10609
File abc.c function abc_ after assignment
File abc.f Calling ABC with Arguments:
File abc.f Calling ABC with MY_ADDRESS = 553637392 and MyInt =
File abc.f 1 MY_ADDRESS + MyInt * 4= 553637396
File abc.c function abc_ before assignment MY_ADDRESS =477741372 and my_address = 4482680
File abc.c function abc_ before assignment *MY_ADDRESS =553637396 and my_address->my_value = 0

Program received signal SIGSEGV: Segmentation fault - invalid memory reference.


[3]File abc.f

    INTEGER VALUE,MYInt,N,MY_ADDRESS
     …
C MY_ADDRESS = …
      DO 14 MyInt=VALUE+1,N
       print *,'File abc.f Calling ABC with Arguments:'
       print *,'File abc.f Calling ABC with MY_ADDRESS = ', MY_ADDRESS,' and MyInt = '
       print *,’File abc.f’, MyInt,' MY_ADDRESS + MyInt * 4=',MY_ADDRESS+MyInt*4
       CALL ABC (MY_ADDRESS + MyInt * 4, 0)
14    CONTINUE

[4]File abc.c

struct BIG_CHANCE {
   int my_value;
};
  int abc_(MY_ADDRESS,my_address)
  register struct BIG_CHANCE **MY_ADDRESS,*my_address;
{
    printf ("File abc.c function abc_ before assignment MY_ADDRESS =%d and my_address = %d\n",MY_ADDRESS,my_address);
    printf ("File abc.c function abc_ before assignment *MY_ADDRESS =%d and my_address->my_value = %d\n",*MY_ADDRESS,my_address->my_value);
    (*MY_ADDRESS)->my_value=my_address->my_value;
    printf ("File abc.c function abc_ after assignment\n");
  return;
}

[5]Compilation of C file:
cc -DLINUX -I../include -g -c -o abc.o abc.c


[6]Compilation of Fortran file:
gfortran -g -fno-second-underscore -c abc.f

I understand that you are linking the two files together into a hybrid Fortran+C code executable. If so, you should use modern Fortran “C bindings” features, otherwise it is implementation dependent and error-prone.

Fortran code sends (at least we presume it does) two adresses of temporary memory where the values of expression MY_ADDRESS + MyInt * 4 and of 0 constant are kept. On the C side the first of these addresses is interpreted as double pointer to a BIG_CHANCE struct. So trying to assign a value to (*MY_ADDRESS)->my_value you are using integer value of MY_ADDRESS + MyInt * 4 as an address of the integer member of the struct. It just cannot work. If it does not segfaults it only means that you pointed to a memory which (by chance) was inside the space of your program.

There are many other errors in the code which should be fixed as @kargl suggested.

Also, the compilation commands as you put it cannot work.
cc -DLINUX -I…/include -g -c -o abc.c has three dots instead of two and also has no input source file, as the compiler interprets -o abc.c as if abc.c were meant to contain output object code.

I’ve made the following corrections to the C file compilation:

I’ve corrected the “…” by using the “Preformated text” option from the menu.

I’ve also added abc.o to this. It was a typographical error.

Well, I tried adding the options suggested, and I was rewarded with the following error message:

CALL XYZ (IGIFT, IXYZ(DATA(INDIGO,3)),N)

Warning: Type mismatch in argument ‘a’ at (1); passed INTEGER(4) to REAL(4)
Fatal Error: Error count reached limit of 1.
make: *** [xyz.o] Error 1

So, I tried adding “implicit none” to the routine as the Internet implied, but the error still occurs.

There doesn’t appear to be a ton of information on the Internet about this specific error. What should I do? Can you give me practical examples?

Thanks

Without the code nobody will be able to help.
Compiler stopped on the first error according to -fmax-errors=1 option

As my first attempt, doing as suggested makes me feel that this will be a messy. I’ll probably hit dead ends and have to restart a few times. This first time I’m not going to take notes. I also have to convert tabs to blank characters which is a minor problem.

Thanks …