This is the mail archive of the
fortran@gcc.gnu.org
mailing list for the GNU Fortran project.
Re: [Bug fortran/32732] [Bind C] Character scalars are passed as arrays
The new results:
================================================================
$ gcc test_bug_fortran_32732.c -o test_bug_fortran_32732.gcc
$ ./test_bug_fortran_32732.gcc
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
-------------------------------------------------------------
$ gfc test_bug_fortran_32732.F95 -o test_bug_fortran_32732.gfc
$ ./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 = 16, kind = 8
complex long double: sizeof = 24, 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
================================================================
They look ok to me. Or not?
Cheers,
Angelo.
On Thu, 26 Jul 2007, Tobias Burnus wrote:
> Hi,
>
> Thanks Angelo for testing. I'm mostly interested in platforms where ISO
> Bind C fails (such as ia64 HP-UX or some(!) powerpc64-unknown-linux-gnu)
> and I assume it works on i686 Linux. If it does not I am highly
> interested in knowing what fails.
>
> In any case, you found some bugs in my test case; besides the
> integer-kind problem the following real programming error:
>
> Angelo Graziosi wrote:
>
> > complex float: sizeof = 8, kind = 4
> > complex double: sizeof = 8, kind = 8
> > complex long double: sizeof = 8, kind = 10
> >
> And another mistake by me; it should be:
>
> call printf("complex float", sizeof(cmplx(0.0, 0.0, c_float_complex)), c_float_complex);
> call printf("complex double", sizeof(cmplx(0.0, 0.0, c_double_complex)), c_double_complex);
> call printf("complex long double", sizeof(cmplx(0.0, 0.0, c_long_double_complex)), c_long_double_complex);
>
>
> I was passing c_*_complex not as KIND but at imaginary number to
> "cmplx"; thanks for catching this.
>
> Tobias
>
>