Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-42717

FPE Exception : FE_INVALID & Qt

    XMLWordPrintable

Details

    • Bug
    • Resolution: Out of scope
    • P2: Important
    • None
    • 4.8.0, 5.3.2
    • None
    • Tested on :
      Qt4.8 / Qt5.3 and MacOSX 10.9
      Qt4.8 and MacOSX 10.10
    • 40c927e7331ea4ac9ca50de48560b700e657cded

    Description

      The application crash when enable the Floating point exception FE_INVALID exception.
      Try the following (tested on Qt 4.8 & 5.3 on Mac OSX)
      For commodity reason, I've copy/paste the feenableexcept() from glib
      Any idea ? glib problem or Qt problem ??

      Thanks,
      Laurent

      #include <qapplication.h>
      #include <qmainwindow.h>
      #include <qlineedit.h>
      
      #include <fenv.h>
      
      int main(int argc,char** argv) {
        
        // ------------------------------------------------------
        // ENABLE FPE : Copy/Paste feenableexcept() code from glib
        // ------------------------------------------------------
        unsigned int excepts = FE_INVALID;
        static fenv_t fenv;
        unsigned int new_excepts = excepts & FE_ALL_EXCEPT,
        old_excepts;  // previous masks
        
        if ( fegetenv (&fenv) )  { return -1; }
        old_excepts = fenv.__control & FE_ALL_EXCEPT;
        
        // unmask
        //
        fenv.__control &= ~new_excepts;
        fenv.__mxcsr   &= ~(new_excepts << 7);
        
        int result =  ( fesetenv (&fenv) ? -1 : old_excepts );
        // ------------------------------------------------------
      
        // ------------------------------------------------------
        // Create a minimum window
        // ------------------------------------------------------
        QApplication application(argc, argv);
        QLineEdit edit;
        edit.show();
      
        // Will crash at the next line if you type "O" in the lineEdit
        // Will also crash for other random strings ;-)
        qApp->exec();
        
        return 0;
      }
      

      Attachments

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            mmutz Marc Mutz
            garnier@lal.in2p3.fr Garnier Laurent
            Votes:
            7 Vote for this issue
            Watchers:
            5 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes