Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / fpc-devel / 2008-06

fpc and delphi applications cause floating point exceptions in other windows software :)

6 messages · 4 people ·

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Paul Ishenin

Hello, FPC developers' list.

While implementing cursor support for gtk2 I noticed that lazarus crashed every time with SIGFPE: division by zero in ICM32.dll if we used GdkPixbuf as an image for the cursor. In that time I made a woraround to use old gtk1 code for windows case (which used GtkPixmap's for the same task).

Now lazarus needs icon support and the same thing: when GdkPixbuf is an icon image then we have SIGFPE: division by zero at the same dll.

Ok, I searched the internet and found this gtk issue: http://bugzilla.gnome.org/show_bug.cgi?id=316645 where ppl complained about borland tools which incorrectly modifies CPU flags and this cause crahes in other software (in that case GIMP).

I've made a conclusion that I have the same issue but with FPC. I disabled floating point exceptions before my gdk call and I see no crash and working cursors and icons.

I'm not skilled in compilers, CPUs and FPUs and I just want to ask you if it is ok?

Best regards, Paul Ishenin.

Reply by email

thaddy
to Paul Ishenin

Delphi has a utility routine for that. Set8087CW() This is because some compilers, like gcc and microsoft do not stick to the intel specs and Delphi/BCC does.
With this controlword utility you can save and restore the FPU flags before and after intensive FPU operations.
They thought this the better option than "fix"something that wasn't really their bug....

Paul Ishenin wrote 37 lines
Hello, FPC developers' list. While implementing cursor support for gtk2 I noticed that lazarus crashed every time with SIGFPE: division by zero in ICM32.dll if we used GdkPixbuf as an image for the cursor. In that time I made a woraround to use old gtk1 code for windows case (which used GtkPixmap's for the same task). Now lazarus needs icon support and the same thing: when GdkPixbuf is an icon image then we have SIGFPE: division by zero at the same dll. Ok, I searched the internet and found this gtk issue: http://bugzilla.gnome.org/show_bug.cgi?id=316645 where ppl complained about borland tools which incorrectly modifies CPU flags and this cause crahes in other software (in that case GIMP). I've made a conclusion that I have the same issue but with FPC. I disabled floating point exceptions before my gdk call and I see no crash and working cursors and icons. I'm not skilled in compilers, CPUs and FPUs and I just want to ask you if it is ok? -- Best regards, Paul Ishenin. _______________________________________________ fpc-devel maillist - http://lists.freepascal.org/mailman/listinfo/fpc-devel ------------------------------------------------------------------------ No virus found in this incoming message. Checked by AVG. Version: 8.0.100 / Virus Database: 270.2.0/1495 - Release Date: 10/06/2008 17:11

Reply by email

Marco van de Voort
to Paul Ishenin: Hello, FPC developers' list. While implementing cursor support for gtk2 I noticed that…
Show quoted text 14 lines
Now lazarus needs icon support and the same thing: when GdkPixbuf is an icon image then we have SIGFPE: division by zero at the same dll. Ok, I searched the internet and found this gtk issue: http://bugzilla.gnome.org/show_bug.cgi?id=316645 where ppl complained about borland tools which incorrectly modifies CPU flags and this cause crahes in other software (in that case GIMP). I've made a conclusion that I have the same issue but with FPC. I disabled floating point exceptions before my gdk call and I see no crash and working cursors and icons. I'm not skilled in compilers, CPUs and FPUs and I just want to ask you if it is ok?

This can break a lot of Delphi code, so preferably don't do it. Best solution is to ask on that bugreport for references that state that modifying FPU state isn't allowed. (and then maybne separately for several supported OSes, *nix/OSX/Windows)

Reply by email

Paul Ishenin
to Marco van de Voort
Marco van de Voort wrote
This can break a lot of Delphi code, so preferably don't do it. Best solution is to ask on that bugreport for references that state that modifying FPU state isn't allowed. (and then maybne separately for several supported OSes, *nix/OSX/Windows)

What can I break if I modify control word before gdk function call and restore it after?

Best regards,
Paul Ishenin.

Reply by email

Marco van de Voort
to Paul Ishenin
Show quoted text 9 lines
Marco van de Voort wrote: > This can break a lot of Delphi code, so preferably don't do it. Best > solution is to ask on that bugreport for references that state that > modifying FPU state isn't allowed. (and then maybne separately for several > supported OSes, *nix/OSX/Windows) What can I break if I modify control word before gdk function call and restore it after?

That's ok, then I misunderstood. I assumed to turn the changing off globally.

Reply by email