pr17423

Feng Wang wf_cs@yahoo.com
Fri May 6 12:48:00 GMT 2005


We create an auxiliary variable to hold the address of target label or format
string. The variable is created with pvoid type.

--- Jerry DeLisle <jvdelisle@verizon.net> дµÀ:
> I picked this problem to work on as a focus point for my study.  I have 
> been able to dig into this enough to find what looks like a sort of type 
> mismatch in:
> 
> trans-stmt.c:gfc_trans_label_assign().
> 
> By changing pchar_type_node to pvoid_type_node I can get past the ICE on 
> the ASSIGN statement, but then WRITE is broken. The original ICE is 

When translating i/o statements, we use pchar type variable to hold the address
of format string. We should add a fold_convert as followes:

Index: trans-io.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/fortran/trans-io.c,v
retrieving revision 1.35
diff -c -3 -p -r1.35 trans-io.c
*** trans-io.c  17 Apr 2005 20:09:33 -0000      1.35
--- trans-io.c  6 May 2005 12:32:24 -0000
*************** set_string (stmtblock_t * block, stmtblo
*** 394,400 ****
        tmp = build2 (LE_EXPR, boolean_type_node,
                    tmp, convert (TREE_TYPE (tmp), integer_minus_one_node));
        gfc_trans_runtime_check (tmp, msg, &se.pre);
!       gfc_add_modify_expr (&se.pre, io, GFC_DECL_ASSIGN_ADDR (se.expr));
        gfc_add_modify_expr (&se.pre, len, GFC_DECL_STRING_LEN (se.expr));
      }
    else
--- 394,401 ----
        tmp = build2 (LE_EXPR, boolean_type_node,
                    tmp, convert (TREE_TYPE (tmp), integer_minus_one_node));
        gfc_trans_runtime_check (tmp, msg, &se.pre);
!       gfc_add_modify_expr (&se.pre, io,
!                fold_convert (TREE_TYPE (io), GFC_DECL_ASSIGN_ADDR
(se.expr)));
        gfc_add_modify_expr (&se.pre, len, GFC_DECL_STRING_LEN (se.expr));
      }
    else


>      }
>    else
>      {
>        label_str = code->label->format->value.character.string;
>        label_len = code->label->format->value.character.length;
>        len_tree = build_int_cst (NULL_TREE, label_len);
>        label_tree = gfc_build_string_const (label_len, label_str);
> 
> 	/* I modified the following statement */
> 
>        label_tree = gfc_build_addr_expr (pvoid_type_node, label_tree);

OK.

>      }
> 
>    gfc_add_modify_expr (&se.pre, len, len_tree);
>    gfc_add_modify_expr (&se.pre, addr, label_tree);
> 


Best Regards,
Feng Wang

--
Creative Compiler Research Group,
National University of Defense Technology, China.

_________________________________________________________
Do You Yahoo!?
150ÍòÇúMP3·è¿ñËÑ£¬´øÄú´³ÈëÒôÀÖµîÌÃ
http://music.yisou.com/
ÃÀÅ®Ã÷ÐÇÓ¦Óо¡ÓУ¬ËѱéÃÀͼ¡¢ÑÞͼºÍ¿áͼ
http://image.yisou.com
1G¾ÍÊÇ1000Õ×£¬ÑÅ»¢µçÓÊ×ÔÖúÀ©ÈÝ£¡
http://cn.rd.yahoo.com/mail_cn/tag/1g/*http://cn.mail.yahoo.com/event/mail_1g/



More information about the Fortran mailing list