From: Robert Williams <bob@bob.usuf2.usuhs.mil>
To: axp-list@redhat.com
Subject: g77 broken in egcs-98032 on axp/Linux
Date: Tue, 31 Mar 1998 12:17:39 -0500 [thread overview]
Message-ID: <35212533.A524B205@bob.usuf2.usuhs.mil> (raw)
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/
next reply other threads:[~1998-03-31 17:18 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
1998-03-31 17:17 Robert Williams [this message]
1998-03-31 18:52 ` g77 broken in egcs-98032 on axp/Linux Ladislav Zejda
1998-03-31 22:38 ` Robert Williams
1998-03-29 3:01 ` Ladislav Zejda
read-only archive
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox