mirror of
https://gcc.gnu.org/git/gcc.git
synced 2024-11-25 20:03:58 +08:00
6ad5cf725f
2007-07-21 Christopher D. Rickett <crickett@lanl.gov> PR fortran/32627 * resolve.c (set_name_and_label): Set kind number for character version of c_f_pointer. (gfc_iso_c_sub_interface): Set the kind of the SHAPE formal arg to that of the actual SHAPE arg. * symbol.c (gen_shape_param): Initialize kind for SHAPE arg. 2007-07-21 Christopher D. Rickett <crickett@lanl.gov> PR fortran/32627 * libgfortran/intrinsics/iso_c_generated_procs.c: Add c_f_pointer for character/string arguments. * libgfortran/intrinsic/iso_c_binding.c (c_f_pointer_u0): Allow the optional SHAPE arg to be any valid integer kind. * libgfortran/gfortran.map: Add c_f_pointer_s0. * libgfortran/mk-kinds-h.sh: Save smallest integer kind as default character kind. * libgfortran/intrinsics/iso_c_generated_procs.c: Add versions of c_f_pointer for complex and logical types. * libgfortran/gfortran.map: Add c_f_pointer versions for logical and complex types. 2007-07-21 Christopher D. Rickett <crickett@lanl.gov> PR fortran/32627 * gfortran.dg/pr32627_driver.c: Driver for pr32627. * gfortran.dg/pr32627.f03: New test case. * gfortran.dg/c_f_pointer_logical.f03: New test case. * gfortran.dg/c_f_pointer_logical_driver.c: Driver for c_f_pointer_logical. * gfortran.dg/c_f_pointer_complex_driver.c: Driver for c_f_pointer_complex. * gfortran.dg/c_f_pointer_complex.f03: New test case. * gfortran.dg/c_f_pointer_shape_tests_2_driver.c: Driver for c_f_pointer_shape_tests_2. * gfortran.dg/c_f_pointer_shape_tests_2.f03: New test case. From-SVN: r126817
74 lines
1.8 KiB
Bash
Executable File
74 lines
1.8 KiB
Bash
Executable File
#!/bin/sh
|
|
|
|
compile="$1"
|
|
|
|
# Possible types must be listed in ascending order
|
|
possible_integer_kinds="1 2 4 8 16"
|
|
possible_real_kinds="4 8 10 16"
|
|
|
|
|
|
largest=""
|
|
smallest=""
|
|
for k in $possible_integer_kinds; do
|
|
echo " integer (kind=$k) :: i" > tmp$$.f90
|
|
echo " end" >> tmp$$.f90
|
|
if $compile -c tmp$$.f90 > /dev/null 2>&1; then
|
|
s=`expr 8 \* $k`
|
|
largest="$k"
|
|
|
|
if [ $s -eq 128 ]; then
|
|
prefix="__"
|
|
else
|
|
prefix=""
|
|
fi
|
|
|
|
if [ "$smallest" = "" ]; then
|
|
smallest="$k"
|
|
fi
|
|
|
|
echo "typedef ${prefix}int${s}_t GFC_INTEGER_${k};"
|
|
echo "typedef ${prefix}uint${s}_t GFC_UINTEGER_${k};"
|
|
echo "typedef GFC_INTEGER_${k} GFC_LOGICAL_${k};"
|
|
echo "#define HAVE_GFC_LOGICAL_${k}"
|
|
echo "#define HAVE_GFC_INTEGER_${k}"
|
|
fi
|
|
rm -f tmp$$.*
|
|
done
|
|
|
|
echo "#define GFC_INTEGER_LARGEST GFC_INTEGER_${largest}"
|
|
echo "#define GFC_UINTEGER_LARGEST GFC_UINTEGER_${largest}"
|
|
echo "#define GFC_DEFAULT_CHAR ${smallest}"
|
|
echo ""
|
|
|
|
|
|
largest_ctype=""
|
|
for k in $possible_real_kinds; do
|
|
echo " real (kind=$k) :: x" > tmp$$.f90
|
|
echo " end" >> tmp$$.f90
|
|
if $compile -c tmp$$.f90 > /dev/null 2>&1; then
|
|
case $k in
|
|
4) ctype="float" ;;
|
|
8) ctype="double" ;;
|
|
10) ctype="long double" ;;
|
|
16) ctype="long double" ;;
|
|
*) echo "$0: Unknown type" >&2 ; exit 1 ;;
|
|
esac
|
|
largest_ctype="$ctype"
|
|
echo "typedef ${ctype} GFC_REAL_${k};"
|
|
echo "typedef complex ${ctype} GFC_COMPLEX_${k};"
|
|
echo "#define HAVE_GFC_REAL_${k}"
|
|
echo "#define HAVE_GFC_COMPLEX_${k}"
|
|
fi
|
|
rm -f tmp$$.*
|
|
done
|
|
|
|
case $largest_ctype in
|
|
float) echo "#define GFC_REAL_LARGEST_FORMAT \"\"" ;;
|
|
double) echo "#define GFC_REAL_LARGEST_FORMAT \"l\"" ;;
|
|
"long double") echo "#define GFC_REAL_LARGEST_FORMAT \"L\"" ;;
|
|
*) echo "$0: Unknown type" >&2 ; exit 1 ;;
|
|
esac
|
|
echo "#define GFC_REAL_LARGEST $largest_ctype"
|
|
|
|
exit 0
|