[Patch, Fortran] PR 42072: [F03] wrong-code with C_F_PROCPOINTER

Dominique Dhumieres dominiq@lps.ens.fr
Thu Nov 19 04:28:00 GMT 2009


> Thanks. Committed as r154292.

This change the ICE in pr38849 for the code

FUNCTION myfortran_error ()
  USE ISO_C_BINDING
  IMPLICIT NONE
  CHARACTER(LEN=5) :: myfortran_error
  CHARACTER(KIND=C_CHAR, LEN=5), POINTER :: chararr
  TYPE(C_PTR) :: c_str

  c_str = C_NULL_PTR
  CALL C_F_POINTER (c_str, chararr)

  myfortran_error(1:1) = chararr(1)
END FUNCTION myfortran_error

from

pr38849.f90: In function 'myfortran_error':
pr38849.f90:8:0: internal compiler error: in fold_convert_loc, at fold-const.c:2793

to

gimplification failed:
chararr <addr_expr 0x416968c0
    type <pointer_type 0x41693b54
        type <function_type 0x41693af0 type <void_type 0x416157d0 void>
            QI
            size <integer_cst 0x416052ac constant 8>
            unit size <integer_cst 0x416052d0 constant 1>
            align 8 symtab 0 alias set -1 canonical type 0x41693af0
            arg-types <tree_list 0x416943f0 value <reference_type 0x41693a8c>
                chain <tree_list 0x4169440c value <integer_type 0x416152bc integer(kind=4)>
                    chain <tree_list 0x41694428 value <void_type 0x416157d0 void>>>>
            pointer_to_this <pointer_type 0x41693b54>>
        unsigned SI
        size <integer_cst 0x416054a4 constant 32>
        unit size <integer_cst 0x416051f8 constant 4>
        align 32 symtab 0 alias set -1 canonical type 0x41693b54>
    constant
    arg 0 <function_decl 0x41695480 chararr type <function_type 0x41693af0>
        public external QI file pr38849.f90 line 5 col 0 align 8
        chain <function_decl 0x41695380 myfortran_error type <function_type 0x416938fc>
            public static QI file pr38849.f90 line 1 col 0 align 8 initial <block 0x416130e0> arguments <parm_decl 0x4160c280 __result> result <result_decl 0x4160c1e0 D.1476>
            (mem:QI (symbol_ref:SI ("myfortran_error_") [flags 0x403] <function_decl 0x41695380 myfortran_error>) [0 S1 A8])
            struct-function 0x416110a8 chain <function_decl 0x41695300 _gfortran_st_set_nml_var_dim>>>>
pr38849.f90: In function 'myfortran_error':
pr38849.f90:9:0: internal compiler error: gimplification failed

Cheers

Dominique



More information about the Fortran mailing list