浏览代码

* don't simply replace the resultdef of typeconverted nodes if the new
and old def have a different deftype (see added comment why)

git-svn-id: branches/jvmbackend@18492 -

Jonas Maebe 14 年之前
父节点
当前提交
be92f47cc7
共有 1 个文件被更改,包括 8 次插入1 次删除
  1. 8 1
      compiler/ncnv.pas

+ 8 - 1
compiler/ncnv.pas

@@ -308,8 +308,15 @@ implementation
 
         { don't insert superfluous type conversions, but
           in case of bitpacked accesses, the original type must
-          remain too so that not too many/few bits are laoded }
+          remain too so that not too many/few bits are laoded.
+
+          Also, in case the deftyp changes, don't ignore because lots of code
+          expects that if the resultdef is set to e.g. stringdef, it remains
+          that way (e.g., in case of Java where java_jlstring equals
+          unicodestring according to equal_defs, but an add node for strings
+          still expects the resultdef of the node to be a stringdef) }
         if equal_defs(p.resultdef,def) and
+           (p.resultdef.typ=def.typ) and
            not is_bitpacked_access(p) then
           p.resultdef:=def
         else