gm2
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Gm2] whole number checking and float nan checking at runtime/compiletim


From: Gaius Mulley
Subject: [Gm2] whole number checking and float nan checking at runtime/compiletime mostly implemented
Date: Tue, 02 Jan 2018 08:16:21 +0000
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.5 (gnu/linux)

Hello,

here is the changelog for the gm2 trunc since December 2017.  The key
changes are:

  *  new options:   -fwhole-value  -ffloat-value
     which turn on runtime checking of whole number limits and floating
     point limit (NaN) checking.  If a floating point operator is
     about to result in a NaN then an exception is called
     (the default handler issues file:line:column and operator
     which has caused the problem.
     The whole number limit, is partially implemented - addition and
     subtraction are implemented (multiply and negate still to do).
     Again if the default handler is called then the file:line:column
     and operator message is issued.
     -fsoft-check-all will also turn on these switches.  You can disable these
     options by -fno-whole-value and -fno-float-value.

  *  new builtins isfinite, isfinitef, isfinitel are available from
     Builtins.def.  This is also used internally to implement the floating
     point NaN checking.

The range checking completes all features of ISO Modula-2 - and now we
see a few more regression tests (or extreme programming tests) succeed
(gm2/switches/check-all/run/fail/intrange.mod for example).  Range
checking still needs multiply, negate and also complex numbers should
also be tested for NaNs.  But hopefully these changes should be useful
and might detect more runtime bugs

regards,
Gaius



2018-01-02      Gaius Mulley <address@hidden>

        * gm2/gm2-compiler/M2GenGCC.mod:  (CodeStatement) call
          CodeAddChecked and call CodeSubChecked.
          (CodeAddChecked)  New procedure.  (CodeSubChecked)
          New procedure.
        * gm2/gm2-compiler/M2Quads.mod:  (BuildEndFor) suppress
          overflow checking in the addition
          of the loop variable.  The explicit for loop check will
          catch an overflow and this addition can overflow for
          unsigned types counting down.
        * gm2/gm2-gcc/m2expr.c:  (BuildAddCheck) corrected
          comments and strip results.  (BuildSubCheck) corrected
          comments and strip results.

2018-01-01      Gaius Mulley <address@hidden>

        * gm2/gm2-compiler/M2GenGCC.mod:  (CodeAddCheck) New procedure.
          (CodeSubCheck) New procedure.  (CodeBinaryCheck) New procedure.
          Use CodeAddCheck and CodeSubCheck.
        * gm2/gm2-compiler/M2Range.def:  (GetMinMax) exported.
        * gm2/gm2-gcc/m2expr.c:  (BuildAddCheck) New function.
          (BuildSubCheck) New function.  (checkWholeAddOverflow)
          parameters changed.  (checkWholeSubOverflow)  New function.
          (checkWholeOverflow) updated parameters to include subrange min
          and max.  (build_binary_op_check)  New function.  (build_binary_op)
          call build_binary_op_check.
        * gm2/gm2-gcc/m2expr.def:  (BuildBinCheckProcedure) New
          definition.  (BuildSubCheck) New procedure function.
          (BuildAddCheck) New procedure function.
        * gm2/gm2-gcc/m2expr.h:  (BuildAddCheck)  New prototype.
          (BuildSubCheck)  New prototype.
        * gm2/gm2-compiler/M2GenGCC.mod:  pass lowest into binop.
        * gm2/gm2-gcc/m2expr.c:  (BuildAddCheck) extra parameter lowest.
          (BuildSubCheck) extra parameter lowest.  Call build_binary_op
          with extra parameter lowest.  (BuildLessThanZero) New function.
          (BuildGreaterThanZero) New function.  (checkWholeAddOverflow)
          extra parameter and use BuildLessThanZero and
          BuildGreaterThanZero.    (checkWholeSubOverflow)
          extra parameter and use BuildLessThanZero and
          BuildGreaterThanZero.  (checkWholeOverflow) call
          checkWholeAddOverflow and checkWholeSubOverflow with an extra
          parameter.
        * gm2/gm2-gcc/m2expr.def:  (BuildBinCheckProcedure) extra
          parameter.  (BuildSubCheck) extra parameter lowest.
          (BuildAddCheck) extra parameter lowest.
        * gm2/gm2-gcc/m2expr.h:  corrected prototype.

2017-12-31      Gaius Mulley <address@hidden>

        * gm2/gm2-compiler/M2Base.def:  (ExceptionWholeValue) exported
          and declared.  (ExceptionRealValue) exported and declared.
        * gm2/gm2-compiler/M2Base.mod:  ExceptionWholeValue initialised
          and set appropriately.  ExceptionRealValue initialised and
          set appropriately.
        * gm2/gm2-compiler/M2Options.def:  (SetWholeValueCheck)
          exported and declared.  (GetWholeValueCheck) exported and
          declared.
        * gm2/gm2-compiler/M2Options.mod:  (WholeValueChecking)
          initialised.  (SetFloatValueCheck) corrected declaration.
          (GetWholeValueCheck) New procedure function.
          (SetWholeValueCheck) New procedure.
        * gm2/gm2-compiler/M2Range.def:  (BuildIfCallRealHandlerLoc)
          declared and exported.  (BuildIfCallWholeHandlerLoc)
          declared and exported.
        * gm2/gm2-compiler/M2Range.mod:  (BuildStringParamLoc)
          New procedure.  (CodeErrorCheckLoc) New procedure.
          (IssueWarningLoc) New procedure.
          (BuildIfCallWholeHandlerLoc) New procedure.
          (BuildIfCallRealHandlerLoc) New procedure.
          (BuildIfCallHandlerLoc) New procedure.
        * gm2/gm2-gcc/m2block.c:  (do_add_stmt) check to see if
          a binding level exists.
        * gm2/gm2-gcc/m2builtins.def:  (BuiltInIsfinite) exported.
        * gm2/gm2-gcc/m2expr.c:  (checkWholeAddOverflow) New
          function.  (checkWholeOverflow) New function.
          (checkRealOverflow) correct option check.  Corrected
          qualifier.  (build_binary_op) removed last parameter.
        * gm2/gm2-gcc/m2linemap.c:  (GetLineNoFromLocation)
          New function.  (GetColumnNoFromLocation) New function.
          (GetFilenameFromLocation) New function.  (ErrorAt)
          New function.
        * gm2/gm2-gcc/m2linemap.def: (GetLineNoFromLocation)
          exported and declared.  (GetColumnNoFromLocation)
          exported and declared.
          (GetFilenameFromLocation) exported and declared.
          (ErrorAt) exported and declared.
        * gm2/gm2-gcc/m2linemap.h:  (GetLineNoFromLocation)
          prototype.  (GetColumnNoFromLocation) prototype.
          (GetFilenameFromLocation) prototype.
          (ErrorAt) prototype.
        * gm2/gm2-gcc/m2options.h:  (GetWholeValueCheck)
          prototype.
        * gm2/gm2-lang.c:  handle -fwholevalue.
        * gm2/gm2-libs-iso/M2RTS.def:  (WholeValueException)
          and (RealValueException) declared.
        * gm2/gm2-libs-iso/M2RTS.mod:  (WholeValueException)
          and (RealValueException) New procedures.
        * gm2/gm2-libs/M2RTS.def:  (WholeValueException)
          and (RealValueException) declared.
        * gm2/gm2-libs/M2RTS.mod:  (WholeValueException)
          and (RealValueException) New procedures.
        * gm2/lang-options.h:  -fwholevalue and -fno-wholevalue
          new options added.
        * gm2/lang.opt:  -fwholevalue new option added.
        * gm2/ulm-lib-gm2/std/M2RTS.mod:  (WholeValueException)
          and (RealValueException) New procedures.

2017-12-28      Gaius Mulley <address@hidden>

        * gm2/gm2-compiler/M2Options.def:  (SetFloatValueCheck),
          (GetFloatValueCheck) exported.  (FloatValueChecking) New global
          variable.  (GetFloatValueCheck) New procedure function.
          (SetFloatValueCheck) New procedure.
        * gm2/gm2-compiler/M2Options.mod:  (FloatValueChecking)
          initialise and set accordingly.  (GetFloatValueCheck)
          New procedure function.  (SetFloatValueCheck)  New procedure.
        * gm2/gm2-compiler/M2Range.def:  (BuildIfCallHandlerLoc)  New
          procedure function.
        * gm2/gm2-compiler/M2Range.mod:  (BuildIfCallHandlerLoc)  New
          procedure function implemented.
        * gm2/gm2-gcc/m2expr.c:  (checkWholeOverflow)  New function.
          (checkRealOverflow)  New function.
        * gm2/gm2-gcc/m2options.h:  (SetFloatValueCheck)  New prototype.
          (GetFloatValueCheck)  New prototype.
        * gm2/gm2-lang.c:  handle -ffloatvalue option.
        * gm2/gm2-libs-ch/wrapc.c:  (isfinite)  New function.
          (isfinitel)  New function.  (isfinitef)  New function.
        * gm2/gm2-libs/Builtins.def:  (isfinitel)  New function.
          (isfinitef)  New function.
        * gm2/gm2-libs/Builtins.mod:  (isfinitel)  New function
          implemented.  (isfinitef)  New function implemented.
        * gm2/gm2-libs/wrapc.def:  (isfinitel)  New function.
          (isfinitef)  New function.
        * gm2/lang-options.h:  update comment for -fsoft-check-all.
          Introduce -ffloatvalue.
        * gm2/lang.opt:  introduce -ffloatvalue.  Update comment for
          -fsoft-check-all.

2017-12-27      Gaius Mulley <address@hidden>

        * gm2/gm2-compiler/M2Range.mod:  remove unused variables from
          many procedures.  (RangeCheckReal)  New procedure.
          (RangeCheckOrdinal)  New procedure.  (DoCodeAssignmentExprType)
          call the appropriate check procedure.
        * gm2/gm2-gcc/gcc-consolidation.h:  update dates.
        * gm2/gm2-gcc/m2builtins.c:  (__builtin_isfinite)  New entry.
          (gm2_isfinite_node)  New variable.  (builtin_ftype_int_var)
          New variable.  (BuiltInIsfinite)  New function.
          (DoBuiltinIsfinite)  New function.  (isgreater),
          (isgreaterequal), (isless), (islessequal), (islessgreater),
          (isunordered) new builtins defined.  Lookup gm2_isfinite_node.
        * gm2/gm2-gcc/m2builtins.def:  (BuiltInIsfinite)  New procedure
          function.  Define (BuiltInIsfinite).
        * gm2/gm2-gcc/m2expr.c:  (m2expr_checkWholeOverflow)  New
          function.  (m2expr_checkRealOverflow)  New function.
          (build_binary_op)  call the appropriate check function.
        * gm2/gm2-libs/Builtins.def:  remove nanf, nan, nanl,
          isinf_sign, isinf_sigf and isinf_signl.
        * gm2/gm2-libs/Builtins.mod:  reimplement isfinite.
          Remove nanf, nan, nanl, isinf_sign, isinf_sigf and
          isinf_signl.
        * gm2/gm2-libs/cbuiltin.def:  remove nan, nanf and nanl.
        * gm2/gm2-libs/wrapc.def:  define isfinite.
        * gm2/m2pp.c:  add includes to allow m2pp.c to be built for use
          in cc1.

2017-12-20      Gaius Mulley <address@hidden>

        * gm2/gm2-libs/Builtins.def:  new function definitions
          for (nan), (nanf), (nanl), (isfinite), (isfinitef),
          (isfinitel), (isinf_sign), (isinf_signf), (isinf_signl).
        * gm2/gm2-libs/cbuiltin.def: new function definitions
          for (nan), (nanf), (nanl), (isfinite), (isfinitef),
          (isfinitel), (isinf_sign), (isinf_signf), (isinf_signl).
        * gm2/gm2builtins.c:  add definitions in the static structure
          for (nan), (nanf), (nanl), (isfinite), (isfinitef),
          (isfinitel), (isinf_sign), (isinf_signf), (isinf_signl).



reply via email to

[Prev in Thread] Current Thread [Next in Thread]