This is the mail archive of the
fortran@gcc.gnu.org
mailing list for the GNU Fortran project.
Re: FORTRAN PORTING: fd is corrupted
- From: Andrew Pinski <pinskia at gmail dot com>
- To: vikram_sp <vikramforum at yahoo dot com>
- Cc: fortran at gcc dot gnu dot org
- Date: Fri, 8 Jun 2012 02:11:58 -0700
- Subject: Re: FORTRAN PORTING: fd is corrupted
- References: <33980421.post@talk.nabble.com>
On Fri, Jun 8, 2012 at 2:07 AM, vikram_sp <vikramforum@yahoo.com> wrote:
>
> I am trying to port gcc-4.1.2. After it, I compiled this simple FORTRAN
> program
> ----------------------------
> PRINT *, 'Hello'
> END
> -------------------------------
> On running it was giving SEGFAULT. Then I noted that in the
> libgfortran/io/unix.c open_external() function, fd computed is bad. It
> should be 1 but coming some 8425d4 vague value.
> fd = regular_file(opp, flag); // it should give 1 for write
>
> This is deduced observing the flow of the program.
>
> I have following question in mind
> 1. Is the flow is correct?
> 2. Why it calling regular_file()? Does STDOUT comes under regular_file?
> 3. Why the fd is corrupted?
>
> PS: the _start section of binary is just
> _start>:
> Â Âjump main
> Â Ânop
> Â Ânop
This is broken. You are not calling any of the real startup code
which is done before main. See .ctors sections and the .init_array
sections.
Why are you using a custom startup code anyways?
Thanks,
Andrew Pinski
> I mean i am using custom startup file as shown above and linking with
> -lgfortran, -lgfortranbegin. glibc is also being linked because for WRITE
> __libc_write is being used in the binary.
>
> -----
> Vikram
> --
> View this message in context: http://old.nabble.com/FORTRAN-PORTING%3A-fd-is-corrupted-tp33980421p33980421.html
> Sent from the gcc - fortran mailing list archive at Nabble.com.
>