04.01.2012 15:58, José Mejuto пишет:
Hello FPC,

Tuesday, January 3, 2012, 10:01:54 PM, you wrote:

Do you know which kind of code I must look for to isolate the problem
?
SG>  I'd suggest looking at the constructors containing an 'exit' statement,
SG>  but I'm not entirely sure.
SG>  Does restoring removed line 287 of psub.pas remove the segfault?
SG>  (The line was:
SG>     include(current_procinfo.flags,pi_needs_implicit_finally); )

No, it does not :( The problem seems to happend in a destroy process,
but as it only happends on close window, and in the close process a
lot of objects and interfaces are destroyed I can not track each one
:(

I was hoping otherwise... Actually it is very strange that reverting changes at line 700 (which you mentioned earlier) removes the crash, while reverting line 287 does not, because removing pi_needs_implicit_finally flag is the condition under which code at line 700 could ever execute.

I'll try to create a minimun project that fails, it would need a
firebird and zeoslib.

This is of course the best thing to do.

However, you can as well try the attached simple patch. It prevents temps referenced from 'finally' blocks from being placed to registers.

Regards,
Sergei
Index: nflw.pas
===================================================================
--- nflw.pas    (revision 19960)
+++ nflw.pas    (working copy)
@@ -2000,12 +2000,23 @@
 {*****************************************************************************
                            TTRYFINALLYNODE
 *****************************************************************************}
+    function reset_regvars(var n: tnode; arg: pointer): foreachnoderesult;
+      begin
+        case n.nodetype of
+          temprefn:
+            make_not_regable(n,[]);
+        end;
+        result:=fen_true;
+      end;
 
     constructor ttryfinallynode.create(l,r:tnode);
       begin
         inherited create(tryfinallyn,l,r,nil,nil);
         include(current_procinfo.flags,pi_uses_exceptions);
         implicitframe:=false;
+        { Setting pi_uses_exceptions forces local vars to memory, but not 
temps.
+          Make temps non-regable here. }
+        foreachnodestatic(r,@reset_regvars,nil);
       end;
 
 
_______________________________________________
fpc-devel maillist  -  fpc-devel@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-devel

Reply via email to