Red Hat axp-list: Linux on Alpha (1995-2022)
 help / color / mirror / Atom feed
* Re: g77 broken in egcs-98032 on axp/Linux
  1998-03-31 22:38   ` Robert Williams
@ 1998-03-29  3:01     ` Ladislav Zejda
  0 siblings, 0 replies; 4+ messages in thread
From: Ladislav Zejda @ 1998-03-29  3:01 UTC (permalink / raw)
  To: axp-list

> > I just tried your program in egcs-1.0.2 release and it
> > works fine:...So, maybe you can install egcs-1.0.2
> > release and compare c files.
> > 
> Thanks.  That's one brute force approach.
> The diff between these two directories is 5.8 Mbytes.

 Sorry, I haven't seen the new egcs. I am on a low bandwith right now to look
at it. I didn't thought the development is so fast, it's just a couple weeks!

> As for 1.0.2, egcs-1.0.2 can't handle negative array bounds
> combined with an asteric for the upper bound. 
> The latest snap can, but it can't do a "write"....
> Try this:
> 
>       program bomb
>       integer iname(-1:3)
>       iname(2) = 2
>       call pow(iname)
>       stop
>       end
> 
>       subroutine pow(iname)
>       integer iname(-1:*)
>         Write(6,1000) iname(2)
>  1000   Format(' iname(2) = ',i5)
>       return
>       end
> 
> -- 
> Bob Williams, http://bob.usuf2.usuhs.mil/

 Right, there is a problem. I didn't notice that since I just hate * dimensi-
ons - with parameter definitions there is no problem even for negative  array
bounds. So, unless somebody in know will answer, I see some work for you.

 Good luck!
                   Ladislav Zejda
                   lada@fock.usc.edu


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

* g77 broken in egcs-98032 on axp/Linux
@ 1998-03-31 17:17 Robert Williams
  1998-03-31 18:52 ` Ladislav Zejda
  0 siblings, 1 reply; 4+ messages in thread
From: Robert Williams @ 1998-03-31 17:17 UTC (permalink / raw)
  To: axp-list

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/




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

* Re: g77 broken in egcs-98032 on axp/Linux
  1998-03-31 17:17 g77 broken in egcs-98032 on axp/Linux Robert Williams
@ 1998-03-31 18:52 ` Ladislav Zejda
  1998-03-31 22:38   ` Robert Williams
  0 siblings, 1 reply; 4+ messages in thread
From: Ladislav Zejda @ 1998-03-31 18:52 UTC (permalink / raw)
  To: axp-list

> 
> 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
> 
  ....
> Bob Williams, http://bob.usuf2.usuhs.mil/


 Dear Bob,

 For your information, I just tried your program in egcs-1.0.2 release and it
works fine:

lada@centauri(5):~/>./a.out
 Name = X
lada@centauri(6):~/>g77 --version
egcs-2.90.27 980315 (egcs-1.0.2 release)

(Compiled by "g77 -O2 -g").

 So, maybe you can install egcs-1.0.2 release and compare c files.

 Cheers,
             Ladislav Zejda
             lada@fock.usc.edu
 


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

* Re: g77 broken in egcs-98032 on axp/Linux
  1998-03-31 18:52 ` Ladislav Zejda
@ 1998-03-31 22:38   ` Robert Williams
  1998-03-29  3:01     ` Ladislav Zejda
  0 siblings, 1 reply; 4+ messages in thread
From: Robert Williams @ 1998-03-31 22:38 UTC (permalink / raw)
  To: axp-list

Ladislav Zejda wrote:
> 
> >       program junk
> >      character*10 Name
> >       Name = 'X'
> >         Write(6,1000) Name(1:1)
> >  1000   Format(' Name = ',A)
> >       stop
> >       end
> >
> I just tried your program in egcs-1.0.2 release and it
> works fine:...So, maybe you can install egcs-1.0.2
> release and compare c files.
> 
Thanks.  That's one brute force approach.
The diff between these two directories is 5.8 Mbytes.
As for 1.0.2, egcs-1.0.2 can't handle negative array bounds
combined with an asteric for the upper bound. 
The latest snap can, but it can't do a "write"....
Try this:

      program bomb
      integer iname(-1:3)
      iname(2) = 2
      call pow(iname)
      stop
      end

      subroutine pow(iname)
      integer iname(-1:*)
        Write(6,1000) iname(2)
 1000   Format(' iname(2) = ',i5)
      return
      end

-- 
Bob Williams, http://bob.usuf2.usuhs.mil/


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

end of thread, other threads:[~1998-04-01  3:31 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
1998-03-31 17:17 g77 broken in egcs-98032 on axp/Linux Robert Williams
1998-03-31 18:52 ` Ladislav Zejda
1998-03-31 22:38   ` Robert Williams
1998-03-29  3:01     ` Ladislav Zejda

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox