[rfc] 'union' handling for Fortran

Markus Deuling deuling@de.ibm.com
Sat Jun 9 12:47:00 GMT 2007


Hello,

in SPU target registers are of type spu_builtin_type_vec128 which is a union. A SPU application
written in Fortran cannot access SPU registers because Fortran doesn't know how to handle unions.

(gdb) set language fortran
Warning: the current language does not match this frame.

(gdb) p $r1
$2 = <error reading variable>

(gdb) ptype $r1
type = spu_builtin_type_vec128



A C application accesses it correct:

(gdb) p $r1
$1 = {uint128 = 0x0003ffd00003f6f00003ffd00003ffd0, v2_int64 = 
{1125693748672240, 
    1125693748674512}, v4_int32 = {262096, 259824, 262096, 262096}, v8_int16 = 
{3, 
    -48, 3, -2320, 3, -48, 3, -48}, 
  v16_int8 = "\000\003ÿÐ\000\003öð\000\003ÿÐ\000\003ÿÐ", v2_double = {
    5.5616660895720413e-309, 5.5616660895832664e-309}, v4_float = {3.67274722e-
40, 
    3.64090972e-40, 3.67274722e-40, 3.67274722e-40}}

(gdb) ptype $r1
type = union __spu_builtin_type_vec128 {
    int128_t uint128;
    int64_t v2_int64[2];
    int32_t v4_int32[4];
    int16_t v8_int16[8];
    int8_t v16_int8[16];
    double v2_double[2];
    float v4_float[4];
}


This patch adds support for TYPE_CODE_UNION to Fortran backend by calling the appropriate C routines c_type_print_base and
c_val_print.

ChangeLog:
	* f-typeprint.c (print_equivalent_f77_float_type): Add support for
	TYPE_CODE_UNION.
	* f-valprint.c (f_val_print): Likewise.

Testsuite showed no regressions. Would this be ok to commit ?

-- 
Markus Deuling
GNU Toolchain for Linux on Cell BE
deuling@de.ibm.com

-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: diff-spu-gdb-fix-fortran_registers
URL: <http://sourceware.org/pipermail/gdb-patches/attachments/20070609/e6e1480b/attachment.ksh>


More information about the Gdb-patches mailing list