This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: fortran io with g77 on redhat 7.2 for itanium ( IA64 )
- From: Winfrid Tschiedel <winfrid dot tschiedel at hpc dot fujitsu-siemens dot com>
- To: toon at moene dot indiv dot nluug dot nl (Toon Moene)
- Cc: gcc at gnu dot org
- Date: Wed, 30 Apr 2003 14:41:59 +0200 (MDT)
- Subject: Re: fortran io with g77 on redhat 7.2 for itanium ( IA64 )
- Reply-to: Winfrid dot Tschiedel at hpc dot fujitsu-siemens dot com
Hello Toon,
Please check your answer - I have attached a small program which
tells you about datasizes and representation.
`long' is 8 byte on RedHat 7.2 for Itanium ( IA64 ) as you can see from
the output of the attached program :
uname -a
Linux tiger-4 2.4.9-18smp #1 SMP Tue Dec 11 12:59:00 EST 2001 ia64 unknown
gcc-c++-2.96-112.7.2
gcc-g77-2.96-112.7.2
gcc-2.96-112.7.2
gcc-g77-2.96-112.7.2
glibc-2.2.4-31
glibc-common-2.2.4-31
gcc PVM.c -o PVMc
root@tiger-4 csh 3: time ./PVMc
Data Sizes:
char 1
short 2
int 4
long 8
long long 8
size_t 8
float 4
double 8
long double 16
char* 8
int* 8
int*() 8
Byte Order:
short: 01 02
int: 01 02 03 04
long: 01 02 03 04 05 06 07 08
(char)(-1) = -1
float 3.141593 : db 0f 49 40
float -3.141593 : db 0f 49 c0
double 3.141593 : 18 2d 44 54 fb 21 09 40
double -3.141593 : 18 2d 44 54 fb 21 09 c0
long double 3.141593 : 00 c0 68 21 a2 da 0f c9 00 40 00 00 00 00 00 00
long double -3.141593 : 00 c0 68 21 a2 da 0f c9 00 c0 00 00 00 00 00 00
float 0.000100 : 17 b7 d1 38
float -0.000100 : 17 b7 d1 b8
double 0.000100 : 2d 43 1c eb e2 36 1a 3f
double -0.000100 : 2d 43 1c eb e2 36 1a bf
long 1 : 01 00 00 00 00 00 00 00
long -1 : ff ff ff ff ff ff ff ff
long 111111 : 07 b2 01 00 00 00 00 00
long -111111 : f9 4d fe ff ff ff ff ff
int 111111 : 07 b2 01 00
int -111111 : f9 4d fe ff
Also a remark for fortran direct access files - there is no lengthfield
they are basically byte addressable.
Cheers,
Winfrid
>
> Winfrid Tschiedel wrote:
>
> > Now my questions - do you have already a solution for large records
> > ( > 2 or 4 GBytes ) and how does it look like, and when it will be available.
>
> No, unfortunately not. The size of the record lengths embedded in
> unformatted sequential files (and those used for direct access files)
> just have the size of whatever happens to be `long' on the architecture
> g77 and its run-time library were compiled for.
>
> So on most architectures this is 32 bits, except for Alpha, where it is
> 64 bits.
>
> It's not easy to change this in such a way that everyone could still
> read his/her old unformatted sequential files *and* use the larger size
> when necessary.
>
> [ Not easy here means: g77 is in maintenance mode and this can only
> be solved by introducing a compile time option that determines
> the size of the type used for record lengths, which is a pretty
> involved change ]
>
> I'm sorry.
>
> --
> Toon Moene - mailto:toon@moene.indiv.nluug.nl - phoneto: +31 346 214290
> Saturnushof 14, 3738 XG Maartensdijk, The Netherlands
> Maintainer, GNU Fortran 77: http://gcc.gnu.org/onlinedocs/g77_news.html
> GNU Fortran 95: http://gcc-g95.sourceforge.net/ (under construction)
>
PVM.c :
#include <stdio.h>
#include <math.h>
hdump(p, n)
char *p;
int n;
{
int i;
for (i = 0; i < n; i++)
printf("%02x%s", 0xff & (int)p[i],
(i < n - 1) ? (((i & 15) == 15) ? "\n" : " ") : "\n");
}
main(argc, argv)
int argc;
char **argv;
{
printf("\nData Sizes:\n\
char %d\n\
short %d\n\
int %d\n\
long %d\n\
float %d\n\
double %d\n\
char* %d\n\
int* %d\n\
int*() %d\n",
sizeof(char),
sizeof(short),
sizeof(int),
sizeof(long),
sizeof(float),
sizeof(double),
sizeof(char*),
sizeof(int*),
sizeof(int(*)())
);
{
int j;
int i;
short h;
long l;
printf("\nByte Order:\n");
h = 0;
for (j = 0; j < sizeof(h); j++)
h += (short)(j + 1) << (j * 8);
printf(" short: ");
hdump((char*)&h, sizeof(h));
i = 0;
for (j = 0; j < sizeof(i); j++)
i += (j + 1) << (j * 8);
printf(" int: ");
hdump((char*)&i, sizeof(i));
l = 0;
for (j = 0; j < sizeof(l); j++)
l += (long)(j + 1) << (j * 8);
printf(" long: ");
hdump((char*)&l, sizeof(l));
}
{
char c = -1;
printf("\n(char)(-1) = %d\n", (int)c);
}
{
float f;
double d;
long l;
int i;
f = 3.14159265358979323846;
printf("\nfloat %f : ", f);
hdump((char*)&f, sizeof(f));
f = -3.14159265358979323846;
printf("float %f : ", f);
hdump((char*)&f, sizeof(f));
d = 3.14159265358979323846;
printf("double %f : ", d);
hdump((char*)&d, sizeof(d));
d = -3.14159265358979323846;
printf("double %f : ", d);
hdump((char*)&d, sizeof(d));
f = 0.0001;
printf("float %f : ", f);
hdump((char*)&f, sizeof(f));
f = - 0.0001;
printf("float %f : ", f);
hdump((char*)&f, sizeof(f));
d = 0.0001;
printf("double %f : ", d);
hdump((char*)&d, sizeof(d));
d = - 0.0001;
printf("double %f : ", d);
hdump((char*)&d, sizeof(d));
l = 1;
printf("long %d : ", l);
hdump((char*)&l, sizeof(l));
l = -1;
printf("long %d : ", l);
hdump((char*)&l, sizeof(l));
l = 111111;
printf("long %d : ", l);
hdump((char*)&l, sizeof(l));
l = -111111;
printf("long %d : ", l);
hdump((char*)&l, sizeof(l));
i = 111111;
printf("int %d : ", i);
hdump((char*)&i, sizeof(i));
i = -111111;
printf("int %d : ", i);
hdump((char*)&i, sizeof(i));
}
exit(0);
}
--
_______________________________________________________________________________
Fujitsu Siemens Computers
OEA VC HPC Email: winfrid.tschiedel@hpc.fujitsu-siemens.com
Otto-Hahn-Ring 6 Tel. : ++49-89-636-45652
81739 Muenchen Fax : ++49-89-636-43604
MS Exchange : winfrid.tschiedel@fujitsu-siemens.com