autoconf
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: link and run a (fortran) program redirecting its stdout/stderr


From: Stefano Lattarini
Subject: Re: link and run a (fortran) program redirecting its stdout/stderr
Date: Tue, 13 Oct 2009 15:22:51 +0200
User-agent: KMail/1.12.0 (Linux/2.6.26-1-686; KDE/4.3.0; i686; ; )

At Tuesday 13 October 2009, Ralf Wildenhues <address@hidden> wrote:
> * Stefano Lattarini wrote on Mon, Oct 12, 2009 at 09:20:04PM CEST:
> > I have to compile and link a Fortran 77 test program. and then
> > run it redirecting its stdout/stderr (I need to do so to verify
> > that the `stop' builtin is silent when called without arguments
> > -- unfortunately this is not always the case, e.g. when using
> > gfortran-4.0).
>
> Can you explain what this means or does?  If this is similar to
> checking for the declaration of a C function, then it should be
> handled similarly, i.e., by a suitable compile or link test, rather
> than by trying to parse compiler and/or output.
OK, I must admit that the description of my intentions was really badly
expressed.  I'll try to restate them more clearly.

I *don't* care about compiler warnings or messages at compile time.

What matters to me is that the *program generated* by the compiler,
when executed, is not too verbose w.r.t. the `stop' builtin.

For example, assume that I have a fortran source using the `stop'
builtin *without arguments*, as in:
  
  $ cat foo.f
        program foo
        stop
        end

If I compile the `foo.f' file into the `foo.exe' executable:
  $ f77 -o foo.exe foo.f
then I'd expect that running `foo.exe' will simply produce a sucessful
exit status, and *no message* on stdout or stderr.  This is indeed what
happens with "modern" gfortran (version 4.3) and with the `fort77'
compiler (wrapper arounf f2c + gcc): the generated program behaves
as expected, being completely quiet.

Unfortunately, the foo.exe produced by gfortran-4.0 ends up doing
someting like this:
  $ gfortran-4.0 -o foo.exe foo.f  # no errors or warnings here
  $ ./foo.exe  # this produces the following unwanted message
  STOP 0

To summarize, what I must verify is that the Fortran compiler, when
processing a call to `stop' *without arguments*, does not produce code
which, when executed, will end up writing "STOP 0" or sometinhg similar
on stdout/stderr.  The only way I can think of to accomplish this is to
compile and link a simple test program (like the `foo.f' above), run it
redirecting its output, and analyze this output.  And here I'm stuck,
for the problems described in my previous mail.

Hope things are clearer now.

Thanks,
     Stefano




reply via email to

[Prev in Thread] Current Thread [Next in Thread]