From: breyfogle on
I have an existing code base written (maybe 10 years ago) using Sun's
F77, version 4.2, compiler and I would like to "upgrade" the code to
FORTRAN 90. Should be straight forward since Sun's f90, version 1.2, is
also installed on the same machine. Porting and compiling was as easy
as expected but I immediately ran into a run time problem.

It appears that my installation of f90 can not write to standard error.
Either (a) there is some trick method of specifying stderr that I have
not found in the documentation, or (b) there is a bug in this old
compiler that has probably long since been fixed but is not available to
me, or (c) maybe the f90 compiler's components (such as I/O libraries
etc,) are not installed properly.

For example:

write(0,*) 'hello cruel world...'
stop

This snippet compiles OK and runs as expected if compiled with f77.
However, the same code snippet compiles but aborts at run time with a
1060 library error code which appears to be related to an improperly
opened unit. It appears as if f90 is not opening unit 0 as standard
error while f77 does. BTW, the other preconnected units (5,6) work fine
in both f77 and f90.

Before I complain to my IT folks, could anyone confirm that this
compiler should & can write to standard error?

I would also like to find out if this problem is a known bug with Sun's
f90 version 1.2. If so, was the bug fixed in a later patch that I can
ask my IT department to install. If there is a workaround (such as
explicitly opening unit 0 with some unique file specifier) does anyone
know the key?


The platform is a Sun SPARC station running SunOS 5.8.

--
breyfogle
From: Richard Maine on
breyfogle <breyfogle(a)aol.com> wrote:

> It appears that my installation of f90 can not write to standard error.
....
> write(0,*) 'hello cruel world...'

Why would you think that unit 0 is necessarily standard error? That is
completely compiler dependent. Unit zero is used by some, but by no
means all, compilers as a convention for stanbdard error. Until f2003,
Fortran doesn't define a concept of standard error in the language.

I don't happen to know the details for that particular compiler and OS,
but failing to use a particular nonstandard assumption that your code
depended on doesn't count as a bug.

--
Richard Maine | Good judgement comes from experience;
email: last name at domain . net | experience comes from bad judgement.
domain: summertriangle | -- Mark Twain
From: Michel Olagnon on
breyfogle wrote:
>
> The platform is a Sun SPARC station running SunOS 5.8.
>


snoopy% uname -a
SunOS snoopy 5.8 Generic_108528-03 sun4u sparc SUNW,Ultra-5_10
snoopy% cat tst.f90
write(0,*) 'hello cruel world...'
stop
end
snoopy% f90 -V -o tst tst.f90
f90: Sun WorkShop 6 update 2 Fortran 95 6.2 Patch 111690-07 2002/06/26
f90comp: Sun WorkShop 6 update 2 Fortran 95 6.2 Patch 111690-07 2002/06/26
f90: Cray CF90 Version 3.x.x.x (f41pXXgXXXa48) Tue Jun 24, 2008 09:47:30
f90: COMPILE TIME 0.170000 SECONDS
f90: MAXIMUM FIELD LENGTH 5026710 DECIMAL WORDS
f90: 3 SOURCE LINES
f90: 0 ERRORS, 0 WARNINGS, 0 OTHER MESSAGES, 0 ANSI
ld: Software Generation Utilities - Solaris Link Editors: 5.8-1.299
snoopy% tst
hello cruel world...
snoopy%

From: breyfogle on
On Jun 23, 6:09 pm, nos...(a)see.signature (Richard Maine) wrote:
> breyfogle <breyfo...(a)aol.com> wrote:
> > It appears that my installation of f90 can not write to standard error.
> ...
> > write(0,*) 'hello cruel world...'
>
> Why would you think that unit 0 is necessarily standard error?
>
> --
> Richard Maine | Good judgement comes from experience;
> email: last name at domain . net | experience comes from bad judgement.
> domain: summertriangle | -- Mark Twain

Richard

Because Suns documentation defines three preconnected units, 0, 5 and
6. Unit 5 is stdin, 6 is stdout. It's much of an assumption to
figure out unit 0 is supposed to be stderr.
From: breyfogle on
On Jun 24, 12:50 am, Michel Olagnon <molag...(a)ifremer-a-oter.fr>
wrote:
> breyfogle wrote:
>
> > The platform is a Sun SPARC station running SunOS 5.8.
>
> snoopy% f90 -V -o tst tst.f90
> f90: Sun WorkShop 6 update 2 Fortran 95 6.2 Patch 111690-07 2002/06/26
> f90comp: Sun WorkShop 6 update 2 Fortran 95 6.2 Patch 111690-07 2002/06/26
> f90: Cray CF90 Version 3.x.x.x (f41pXXgXXXa48) Tue Jun 24, 2008 09:47:30
> f90: COMPILE TIME 0.170000 SECONDS
> f90: MAXIMUM FIELD LENGTH 5026710 DECIMAL WORDS
> f90: 3 SOURCE LINES
> f90: 0 ERRORS, 0 WARNINGS, 0 OTHER MESSAGES, 0 ANSI
> ld: Software Generation Utilities - Solaris Link Editors: 5.8-1.299
> snoopy% tst
> hello cruel world...
> snoopy%

Michel

That's exactly what I needed to know. Thank you very much.