language specification

Paul Thomas paulthomas2@wanadoo.fr
Sun Oct 2 05:27:00 GMT 2005


Steve,

>AFAIK, gfortran supports neither structures or unions.
>It targets support for the Fortran 95 standard and 
>backwards compatibility with g77.  The gfortran manual
>(gfortran.info) is fairly incomplete, but you should
>initially look there; then try the g77 manual.  As for
>the standard, try a google seach of "fortran 007.pdf".
>
At the risk of being confusing, that is not quite so:

Paul T

[prt@localhost mytests]# cat test.f90
program struture_union
  type        ::     ztype ! specify the structure type
    sequence
    real      ::     re, im
    integer   ::     refs
  end type ztype
  complex         :: z
  type (ztype)    :: z_dt ! declare a structure
  equivalence (z, z_dt)   ! union of structure and complex
  z_dt%re = 1.0
  z_dt%im = -1.0
  z = (2.0, -2.0)
end
[prt@localhost mytests]# /gcc-clean/bin/gfortran -fdump-tree-original 
test.f90
[prt@localhost mytests]# cat test*al
MAIN__ ()
{
  union
  {
    complex4 z;
    struct ztype z_dt;
  } equiv.0;

  equiv.0.z_dt.re = 1.0e+0;
  equiv.0.z_dt.im = -1.0e+0;
  equiv.0.z = __complex__ (2.0e+0, -2.0e+0);
}




More information about the Fortran mailing list