Преглед изворни кода

* first try to fix #10863 (don't do SSL in case left is already handled in an assignment node)

git-svn-id: trunk@10710 -
florian пре 17 година
родитељ
комит
4e7e0f620a
3 измењених фајлова са 25 додато и 5 уклоњено
  1. 12 2
      compiler/ncgld.pas
  2. 3 2
      compiler/ncgutil.pas
  3. 10 1
      compiler/pass_2.pas

+ 12 - 2
compiler/ncgld.pas

@@ -504,8 +504,9 @@ implementation
          href : treference;
          releaseright : boolean;
          len : aint;
-         r:Tregister;
-
+         r : tregister;
+         leftfirst : boolean;
+         oldflowcontrol : tflowcontrol;
       begin
         location_reset(location,LOC_VOID,OS_NO);
 
@@ -531,6 +532,8 @@ implementation
            ((right.resultdef.needs_inittable) or
             (node_complexity(right)>node_complexity(left))) then
          begin
+           leftfirst:=false;
+
            secondpass(right);
            { increment source reference counter, this is
              useless for constants }
@@ -558,6 +561,9 @@ implementation
          end
         else
          begin
+           { if the left node is handled first, we have to forbid SSL below }
+           leftfirst:=true;
+
            { calculate left sides }
            secondpass(left);
            { decrement destination reference counter }
@@ -569,9 +575,13 @@ implementation
            if codegenerror then
              exit;
 
+           oldflowcontrol:=flowcontrol;
+           include(flowcontrol,fc_lefthandled);
+
            { left can't be never a 64 bit LOC_REGISTER, so the 3. arg }
            { can be false                                             }
            secondpass(right);
+           flowcontrol:=oldflowcontrol;
            { increment source reference counter, this is
              useless for string constants}
            if (right.resultdef.needs_inittable) and

+ 3 - 2
compiler/ncgutil.pas

@@ -2063,7 +2063,7 @@ implementation
         if (current_module.islibrary) then
           if (current_procinfo.procdef.proctypeoption = potype_proginit) then
             exportlib.setinitname(list,current_procinfo.procdef.mangledname);
-        
+
         if (current_procinfo.procdef.proctypeoption=potype_proginit) then
           begin
            if (target_info.system in (systems_darwin+[system_powerpc_macos])) and
@@ -2577,7 +2577,7 @@ implementation
         rr: treplaceregrec;
       begin
         if not (n.location.loc in [LOC_CREGISTER,LOC_CFPUREGISTER,LOC_CMMXREGISTER,LOC_CMMREGISTER]) or
-           ([fc_inflowcontrol,fc_gotolabel] * flowcontrol <> []) then
+          ([fc_inflowcontrol,fc_gotolabel,fc_lefthandled] * flowcontrol <> []) then
           exit;
         rr.old := n.location.register;
         rr.ressym := nil;
@@ -2839,3 +2839,4 @@ implementation
 
 end.
 
+

+ 10 - 1
compiler/pass_2.pas

@@ -29,7 +29,16 @@ uses
    node;
 
     type
-       tenumflowcontrol = (fc_exit,fc_break,fc_continue,fc_inflowcontrol,fc_gotolabel);
+       tenumflowcontrol = (
+         fc_exit,
+         fc_break,
+         fc_continue,
+         fc_inflowcontrol,
+         fc_gotolabel,
+         { the left side of an expression is already handled, so we are
+           not allowed to do ssl }
+         fc_lefthandled);
+
        tflowcontrol = set of tenumflowcontrol;
 
     var