This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c/15716] New: Program jumps to strange location when calling a function - possibly fortran related
- From: "orion at cora dot nwra dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 28 May 2004 20:47:30 -0000
- Subject: [Bug c/15716] New: Program jumps to strange location when calling a function - possibly fortran related
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
I'm running on an x86_64 (dual opteron) running Fedora Core 2. I've tried this
with the 3.2.3, 3.3.3, and 3.4.0 versions available for Fedora and they all
exhibit the same problem. Unfortunately I have not been able to reproduce this
with a simple test case, but perhaps I can get some help on how to further debug
this. I'm compiling without any optimization, just the "-g" flag.
I have the following C function that is called from Fortran:
(gdb) list gp_init.c:205
200 /*! Initializes GPSHMEM and its Fortran 77 memory manager. Addresses of
201 reference Fortran arrays are passed to it and then fed to the \ref
202 gp_init_ma77.
203 \param ptr_num number of pointers passed to this routine
204 */
205 int
206 GPSHMEM_INIT_CORE_F(int* ptr_num, ...)
207 {
208 va_list ap;
209
210 gp_init();
211
212 va_start(ap, ptr_num);
213 gp_init_ma77(*ptr_num, ap);
214
215 va_end(ap);
216
217 return 0;
218 }
Dump of assembler code for function gpshmem_init_core_:
0x000000000040abb9 <gpshmem_init_core_+0>: push %rbp
0x000000000040abba <gpshmem_init_core_+1>: mov %rsp,%rbp
0x000000000040abbd <gpshmem_init_core_+4>: sub $0xf0,%rsp
0x000000000040abc4 <gpshmem_init_core_+11>: mov %rsi,0xffffffffffffff58(%rbp)
0x000000000040abcb <gpshmem_init_core_+18>: mov %rdx,0xffffffffffffff60(%rbp)
0x000000000040abd2 <gpshmem_init_core_+25>: mov %rcx,0xffffffffffffff68(%rbp)
0x000000000040abd9 <gpshmem_init_core_+32>: mov %r8,0xffffffffffffff70(%rbp)
0x000000000040abe0 <gpshmem_init_core_+39>: mov %r9,0xffffffffffffff78(%rbp)
0x000000000040abe7 <gpshmem_init_core_+46>: movzbl %al,%eax
0x000000000040abea <gpshmem_init_core_+49>: mov %rax,0xffffffffffffff18(%rbp)
0x000000000040abf1 <gpshmem_init_core_+56>: mov 0xffffffffffffff18(%rbp),%rdx
0x000000000040abf8 <gpshmem_init_core_+63>: lea 0x0(,%rdx,4),%rax
0x000000000040ac00 <gpshmem_init_core_+71>: movq
$0x40ac3f,0xffffffffffffff18(%rbp)
0x000000000040ac0b <gpshmem_init_core_+82>: sub %rax,0xffffffffffffff18(%rbp)
0x000000000040ac12 <gpshmem_init_core_+89>: lea 0xffffffffffffffff(%rbp),%rax
0x000000000040ac16 <gpshmem_init_core_+93>: mov 0xffffffffffffff18(%rbp),%rdx
0x000000000040ac1d <gpshmem_init_core_+100>: jmpq *%edx
When I reach the last statement above the program jumps to strange location:
0x000000000040ac1d 207 {
(gdb) stepi
0x000000000040aaff in gp_ixputbl (target=0x4009555f570, source=0xeab010,
target_index=0xeab076, size=7516188656, num=0, pe=15380496) at gp_putb.c:269
269 error = ARMCI_PutV(&vector, 1, pe);
and the program crashes.
I'm afraid this is getting far beyond my abilities to track at this point.
Where does "jmpq *$edx" get the jump address from? Printing "$edx" in gdb
returns "void".
--
Summary: Program jumps to strange location when calling a
function - possibly fortran related
Product: gcc
Version: 3.3.4
Status: UNCONFIRMED
Severity: normal
Priority: P2
Component: c
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: orion at cora dot nwra dot com
CC: gcc-bugs at gcc dot gnu dot org
GCC host triplet: x86_64-linux
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=15716