Procedure Pointers: a first patch

Paul Thomas paulthomas2@wanadoo.fr
Sun May 4 13:41:00 GMT 2008


Janus,

I'll take a look at this tomorrow, when I get back to Barcelona.  It is 
certainly correct that a procedure pointer should be a variable.  
However, the gimplifier problem is exactly what stopped me last summer.

The code looks OK:  ptr = proc;

AT the moment, I don't understand...

Cheers

Paul


> Hi all,
>
> attached you find a patch which contains a first attempt to implement
> procedure pointers. It's just a start, so don't expect too much yet.
> It should handle most kinds of proc-pointer declarations, and I have
> started to work on proc-pointer assignments (where I'm stuck right
> now), but haven't looked into calling proc-pointers.
>
> You'll also find a small test case, which at this point produces a
> gimplification failure:
>
> gimplification failed:
> ptr <addr_expr 0xb7c18e60
>     type <pointer_type 0xb7bf5c30
>         type <function_type 0xb7bf5bc8 type <void_type 0xb7beb8f0 void>
>             QI
>             size <integer_cst 0xb7be147c constant 8>
>             unit size <integer_cst 0xb7be1498 constant 1>
>             align 8 symtab 0 alias set -1 canonical type 0xb7bf5bc8
>             pointer_to_this <pointer_type 0xb7bf5c30>>
>         unsigned SI
>         size <integer_cst 0xb7be1604 constant 32>
>         unit size <integer_cst 0xb7be13f0 constant 4>
>         align 32 symtab 0 alias set -1 canonical type 0xb7bf5c30>
>     constant
>     arg 0 <function_decl 0xb7c1d930 ptr type <function_type 0xb7bf5bc8>
>         addressable public external QI file procptr.f90 line 13 col 0 align 8
>         chain <function_decl 0xb7c1d8c0 procptrtest type
> <function_type 0xb7bf5bc8>
>             public static QI file procptr.f90 line 13 col 0 align 8
> attributes <tree_list 0xb7c1cc5c> initial <block 0xb7ee0618> result
> <result_decl 0xb7be6260 D.612>
>             (mem:QI (symbol_ref:SI ("MAIN__") [flags 0x3]
> <function_decl 0xb7c1d8c0 procptrtest>) [0 S1 A8])
>             saved-insns 0xb7be62ac chain <function_decl 0xb7c1d850 proc>>>>
> procptr.f90: In function 'procptrtest':
> procptr.f90:20: internal compiler error: gimplification failed
>
> I tried to understand this error message, but I don't really see
> what's going wrong. I guess I'm missing something in trans-expr.c(?).
> Any hints or ideas are most welcome.
>
> At this point proc-pointer assignments are treated as EXPR_VARIABLE,
> but it might be better to introduce a new EXPR_PROCEDURE. I already
> discussed this with Tobias, and will probably change it later. Right
> now I would be satisfied with *any* solution that works ;)
>
> Cheers,
> Janus
>   




More information about the Fortran mailing list