From mboxrd@z Thu Jan 1 00:00:00 1970 Received: (qmail 22906 invoked from network); 31 Mar 1998 17:18:37 -0000 Received: from unknown (HELO rw.usuf2.usuhs.mil) (131.158.3.44) by mail2.redhat.com with SMTP; 31 Mar 1998 17:18:37 -0000 Received: from bob.usuf2.usuhs.mil (localhost [127.0.0.1]) by rw.usuf2.usuhs.mil (8.8.7/8.8.7) with ESMTP id MAA28943; Tue, 31 Mar 1998 12:17:39 -0500 Sender: bob@rw.usuf2.usuhs.mil Message-ID: <35212533.A524B205@bob.usuf2.usuhs.mil> Date: Tue, 31 Mar 1998 12:17:39 -0500 From: Robert Williams Organization: USUHS X-Mailer: Mozilla 4.04 [en] (X11; I; Linux 2.1.82 alpha) MIME-Version: 1.0 To: axp-list@redhat.com Subject: g77 broken in egcs-98032 on axp/Linux Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit I'm looking for a little help to fix this bug in g77. The following simple program segfaults because (I think) the address of "Name", and perhaps other information, is not getting passed. (Just "Name" in the write statement also bombs.) I'm not quite sure how to proceed from here: program junk character*10 Name Name = 'X' Write(6,1000) Name(1:1) 1000 Format(' Name = ',A) stop end The traceback: Program received signal SIGSEGV, Segmentation fault. 0x120002754 in f_s (s=0x0, curloc=0) at fmt.c:95 Current language: auto; currently c (gdb) bt #0 0x120002754 in f_s (s=0x0, curloc=0) at fmt.c:95 #1 0x120003088 in pars_f (s=0x0) at fmt.c:370 #2 0x120004568 in s_wsfe (a=0x120106f20) at wsfe.c:72 #3 0x12000115c in MAIN__ () at junk.f:5 #4 0x12000142c in main (argc=0, argv=0x0) at main.c:128 wsfe.c fmt.c are source files in gcc/g77 (egcs). wsfe.c: /*write sequential formatted external*/ #include "f2c.h" #include "fio.h" #include "fmt.h" extern int f__hiwater; #ifdef KR_headers x_putc(c) #else x_putc(int c) #endif { /* this uses \n as an indicator of record-end */ if(c == '\n' && f__recpos < f__hiwater) { /* fseek calls fflush, a loss */ #if ! defined (NON_UNIX_STDIO) && ! defined (MISSING_FILE_ELEMS) if(f__cf->_ptr + f__hiwater - f__recpos < buf_end(f__cf)) f__cf->_ptr += f__hiwater - f__recpos; else #endif (void) fseek(f__cf, (long)(f__hiwater - f__recpos), SEEK_CUR); } #ifdef OMIT_BLANK_CC if (!f__recpos++ && c == ' ') return c; #else f__recpos++; #endif return putc(c,f__cf); } x_wSL(Void) { (*f__putn)('\n'); f__recpos=0; f__cursor = 0; f__hiwater = 0; return(1); } xw_end(Void) { if(f__nonl == 0) (*f__putn)('\n'); f__hiwater = f__recpos = f__cursor = 0; return(0); } xw_rev(Void) { if(f__workdone) (*f__putn)('\n'); f__hiwater = f__recpos = f__cursor = 0; return(f__workdone=0); } #ifdef KR_headers integer s_wsfe(a) cilist *a; /*start*/ #else integer s_wsfe(cilist *a) /*start*/ #endif { int n; if(f__init != 1) f_init(); f__init = 3; if(n=c_sfe(a)) return(n); f__reading=0; f__sequential=1; f__formatted=1; f__external=1; f__elist=a; f__hiwater = f__cursor=f__recpos=0; f__nonl = 0; f__scale=0; f__fmtbuf=a->cifmt; f__curunit = &f__units[a->ciunit]; f__cf=f__curunit->ufd; if(pars_f(f__fmtbuf)<0) err(a->cierr,100,"startio"); f__putn= x_putc; f__doed= w_ed; f__doned= w_ned; f__doend=xw_end; f__dorevert=xw_rev; f__donewrec=x_wSL; fmt_bg(); f__cplus=0; f__cblank=f__curunit->ublnk; if(f__curunit->uwrt != 1 && f__nowwriting(f__curunit)) err(a->cierr,errno,"write start"); return(0); } (gdb) print *a $2 = {cierr = 25769803776, ciunit = 0, ciend = 4832915264, cifmt = 0x0, cirec = 2334392246551446056} As you can see, cifmt (the address of the fortran X string) is zero. I'm not sure how to get the information I need. How is the address for the fortran string supposed to get to cifmt? I've been "finding" and "grepping" the egcs source for some clues. Stepping through instructions isn't revealing anything to me. Can anyone help: Breakpoint 1, MAIN__ () at junk.f:5 Current language: auto; currently fortran (gdb) stepi (gdb) stepi (gdb) stepi s_wsfe (a=0x1) at wsfe.c:57 Current language: auto; currently c (gdb) print *a Cannot access memory at address 0x1. -- Bob Williams, http://bob.usuf2.usuhs.mil/