This is the mail archive of the fortran@gcc.gnu.org mailing list for the GNU Fortran project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [Bug fortran/32732] [Bind C] Character scalars are passed as arrays


Using "integer(c_size_t)" the results are:

=================================================================
>From C version:
 ./test_bug_fortran_32732
sizeof(bool) = 1
sizeof(char) = 1

sizeof(signed char) = 1
sizeof(short) = 2
sizeof(int) = 4
sizeof(long) = 4
sizeof(long long) = 8
sizeof(size_t) = 4
sizeof(intptr_t) = 4

sizeof(float) = 4
sizeof(double) = 8
sizeof(long double) = 12
sizeof(complex float) = 8
sizeof(complex double) = 16
sizeof(complex long double) = 24

sizeof(int8_t) = 1
sizeof(uint8_t) = 1
sizeof(int16_t) = 2
sizeof(int16_t) = 2
sizeof(int32_t) = 4
sizeof(int32_t) = 4
sizeof(int64_t) = 8
sizeof(uint64_t) = 8

sizeof(int_least8_t) = 1
sizeof(uint_least8_t) = 1
sizeof(int_least16_t) = 2
sizeof(uint_least16_t) = 2
sizeof(int_least32_t) = 4
sizeof(uint_least32_t) = 4
sizeof(int_least64_t) = 8
sizeof(uint_least64_t) = 8

-----------------------------------------------------------------
>From F95 version:
$ ./test_bug_fortran_32732.gfc
c_bool: sizeof = 1, kind = 1
c_char: sizeof = 1, kind = 1

c_signed_char: sizeof = 1, kind = 1
short: sizeof = 2, kind = 2
int: sizeof = 4, kind = 4
long: sizeof = 4, kind = 4
long long: sizeof = 8, kind = 8
size_t: sizeof = 4, kind = 4
intptr_t: sizeof = 4, kind = 4

float: sizeof = 4, kind = 4
double: sizeof = 8, kind = 8
long double: sizeof = 12, kind = 10
complex float: sizeof = 8, kind = 4
complex double: sizeof = 8, kind = 8
complex long double: sizeof = 8, kind = 10

int8_t: sizeof = 1, kind = 1
int16_t: sizeof = 2, kind = 2
int32_t: sizeof = 4, kind = 4
int64_t: sizeof = 8, kind = 8

int_least8_t: sizeof = 1, kind = 1
int_least16_t: sizeof = 2, kind = 2
int_least32_t: sizeof = 4, kind = 4
int_least64_t: sizeof = 8, kind = 8
=================================================================

It looks that only "complex" data differ.


Cheers,

   Angelo.


On Thu, 26 Jul 2007, Tobias Burnus wrote:

> Hi,
>
> Angelo Graziosi wrote:
> > I have tried to build the fortran test with gfc-20070722 on GNU/Linux
> >
> My mistake. Can you change integer(8) to integer(4) in the subroutine
> printf - or better change it to "integer(c_size_t)". The return value of
> sizeof() depends whether size_t is 32 or 64 bits long; on my x86-64 it
> is 64bits (kind=8).
>
> Tobias
>
>


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]