This is the mail archive of the fortran@gcc.gnu.org mailing list for the GNU Fortran project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [RFC] maybe a patch to fix PR 20954


--- Tobias Schlüter <tobias.schlueter@physik.uni-muenchen.de> wrote:
> Andrew Pinski wrote:
> > The problem here is the types obvious don't match.  This patch adds a 
> > fold_convert
> > but I don't know if it is the correct thing to add as that would mean 
> > we have
> > to look at all the places which use the string length to do that.
> > Does anyone have more insight into the problem than I currently have?
> 
> You're working around the real problem, which is that string lengths should
> always be of type gfc_charlen_type_node.  Unfortunately, a brief grep session
> reveals that there are several places where this assumption is not honored.
> So it might be an easier fix to always convert the string lengths to the
> correct type when they're needed, instead of auditing all the places where
> they're set.
> 

Yes, obviously the character length type is wrong. But we shouldn't do the
conversion here. It is in the gfc_conv_const_charlen() that we generate
character length without using correct type. I think we should fix here.



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/
Index: trans-const.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/fortran/trans-const.c,v
retrieving revision 1.22
diff -c -3 -p -r1.22 trans-const.c
*** trans-const.c	5 Mar 2005 20:14:52 -0000	1.22
--- trans-const.c	12 Apr 2005 02:14:04 -0000
*************** gfc_conv_const_charlen (gfc_charlen * cl
*** 141,146 ****
--- 141,148 ----
      {
        cl->backend_decl = gfc_conv_mpz_to_tree (cl->length->value.integer,
  					       cl->length->ts.kind);
+       cl->backend_decl = fold_convert (gfc_charlen_type_node,
+ 					cl->backend_decl);
      }
  }
  

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]