Explorar o código

* fix shortstring:=char

git-svn-id: trunk@7302 -
peter %!s(int64=18) %!d(string=hai) anos
pai
achega
b3c650bd98
Modificáronse 3 ficheiros con 20 adicións e 2 borrados
  1. 1 0
      .gitattributes
  2. 4 2
      compiler/ncgld.pas
  3. 15 0
      tests/webtbs/tw8838.pp

+ 1 - 0
.gitattributes

@@ -8190,6 +8190,7 @@ tests/webtbs/tw8777f.pp svneol=native#text/plain
 tests/webtbs/tw8777g.pp svneol=native#text/plain
 tests/webtbs/tw8777g.pp svneol=native#text/plain
 tests/webtbs/tw8777i.pp svneol=native#text/plain
 tests/webtbs/tw8777i.pp svneol=native#text/plain
 tests/webtbs/tw8810.pp svneol=native#text/plain
 tests/webtbs/tw8810.pp svneol=native#text/plain
+tests/webtbs/tw8838.pp svneol=native#text/plain
 tests/webtbs/ub1873.pp svneol=native#text/plain
 tests/webtbs/ub1873.pp svneol=native#text/plain
 tests/webtbs/ub1883.pp svneol=native#text/plain
 tests/webtbs/ub1883.pp svneol=native#text/plain
 tests/webtbs/uw0555.pp svneol=native#text/plain
 tests/webtbs/uw0555.pp svneol=native#text/plain

+ 4 - 2
compiler/ncgld.pas

@@ -591,8 +591,10 @@ implementation
                - char
                - char
             }
             }
 
 
-            { The addn is replaced by a blockn or calln }
-            if right.nodetype in [blockn,calln] then
+            { The addn is replaced by a blockn or calln that already returns
+              a shortstring }
+            if is_shortstring(right.resultdef) and
+               (right.nodetype in [blockn,calln]) then
               begin
               begin
                 { nothing to do }
                 { nothing to do }
               end
               end

+ 15 - 0
tests/webtbs/tw8838.pp

@@ -0,0 +1,15 @@
+var
+  c,u: char;
+  s,t: string[6];
+begin
+  c := 'x';
+  u := UpCase(c);
+  s := UpCase(c);
+  t := u;
+  writeln('c = "',c,'"');
+  writeln('u = "',u,'"');
+  writeln('s = "',s,'"');
+  writeln('t = "',t,'"');
+  if (s='') or (t='') then
+    halt(1);
+end.