public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/15716] New: Program jumps to strange location when calling a function - possibly fortran related
@ 2004-05-29 14:45 orion at cora dot nwra dot com
  2004-05-29 15:42 ` [Bug c/15716] " orion at cora dot nwra dot com
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: orion at cora dot nwra dot com @ 2004-05-29 14:45 UTC (permalink / raw)
  To: gcc-bugs

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


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [Bug c/15716] Program jumps to strange location when calling a function - possibly fortran related
  2004-05-29 14:45 [Bug c/15716] New: Program jumps to strange location when calling a function - possibly fortran related orion at cora dot nwra dot com
@ 2004-05-29 15:42 ` orion at cora dot nwra dot com
  2004-05-29 19:57 ` [Bug target/15716] Program jumps to strange location when calling a function pinskia at gcc dot gnu dot org
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: orion at cora dot nwra dot com @ 2004-05-29 15:42 UTC (permalink / raw)
  To: gcc-bugs



-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
            Version|3.3.4                       |3.4.0


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=15716


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [Bug target/15716] Program jumps to strange location when calling a function
  2004-05-29 14:45 [Bug c/15716] New: Program jumps to strange location when calling a function - possibly fortran related orion at cora dot nwra dot com
  2004-05-29 15:42 ` [Bug c/15716] " orion at cora dot nwra dot com
@ 2004-05-29 19:57 ` pinskia at gcc dot gnu dot org
  2004-06-01 11:59 ` pinskia at gcc dot gnu dot org
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-05-29 19:57 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2004-05-28 21:37 -------
Can you attach the preprocessed source for this code?

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |WAITING
          Component|c                           |target
            Summary|Program jumps to strange    |Program jumps to strange
                   |location when calling a     |location when calling a
                   |function - possibly fortran |function
                   |related                     |
            Version|3.4.0                       |3.3.4


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=15716


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [Bug target/15716] Program jumps to strange location when calling a function
  2004-05-29 14:45 [Bug c/15716] New: Program jumps to strange location when calling a function - possibly fortran related orion at cora dot nwra dot com
  2004-05-29 15:42 ` [Bug c/15716] " orion at cora dot nwra dot com
  2004-05-29 19:57 ` [Bug target/15716] Program jumps to strange location when calling a function pinskia at gcc dot gnu dot org
@ 2004-06-01 11:59 ` pinskia at gcc dot gnu dot org
  2004-08-18 21:48 ` orion at cora dot nwra dot com
  2004-08-19 19:37 ` orion at cora dot nwra dot com
  4 siblings, 0 replies; 6+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-06-01 11:59 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2004-06-01 11:59 -------
What options did you use when compiling this file?
Read http://gcc.gnu.org/bugs.html which explains what we need.

-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=15716


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [Bug target/15716] Program jumps to strange location when calling a function
  2004-05-29 14:45 [Bug c/15716] New: Program jumps to strange location when calling a function - possibly fortran related orion at cora dot nwra dot com
                   ` (2 preceding siblings ...)
  2004-06-01 11:59 ` pinskia at gcc dot gnu dot org
@ 2004-08-18 21:48 ` orion at cora dot nwra dot com
  2004-08-19 19:37 ` orion at cora dot nwra dot com
  4 siblings, 0 replies; 6+ messages in thread
From: orion at cora dot nwra dot com @ 2004-08-18 21:48 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From orion at cora dot nwra dot com  2004-08-18 21:48 -------
This appears to be related to a va_list handling code.  It also appears that a
change in the fortran compiler is triggering this, so it doesn't appear to
directly be a gcc issue.  Can you point me to a good description of how the
va_list code works?

-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=15716


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [Bug target/15716] Program jumps to strange location when calling a function
  2004-05-29 14:45 [Bug c/15716] New: Program jumps to strange location when calling a function - possibly fortran related orion at cora dot nwra dot com
                   ` (3 preceding siblings ...)
  2004-08-18 21:48 ` orion at cora dot nwra dot com
@ 2004-08-19 19:37 ` orion at cora dot nwra dot com
  4 siblings, 0 replies; 6+ messages in thread
From: orion at cora dot nwra dot com @ 2004-08-19 19:37 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From orion at cora dot nwra dot com  2004-08-19 19:36 -------
Problem is that pgf90 stopped assuming C functions to be varargs calls and
zeroing %eax before calling (or some such).  With new pgf90 compilers, you need
the -Mx,125,0x200 flag to call C varargs functions.

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|WAITING                     |RESOLVED
         Resolution|                            |INVALID


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=15716


^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2004-08-19 19:37 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-05-29 14:45 [Bug c/15716] New: Program jumps to strange location when calling a function - possibly fortran related orion at cora dot nwra dot com
2004-05-29 15:42 ` [Bug c/15716] " orion at cora dot nwra dot com
2004-05-29 19:57 ` [Bug target/15716] Program jumps to strange location when calling a function pinskia at gcc dot gnu dot org
2004-06-01 11:59 ` pinskia at gcc dot gnu dot org
2004-08-18 21:48 ` orion at cora dot nwra dot com
2004-08-19 19:37 ` orion at cora dot nwra dot com

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).