diff options
author | sebres <sebres@users.sourceforge.net> | 2024-03-15 14:14:47 (GMT) |
---|---|---|
committer | sebres <sebres@users.sourceforge.net> | 2024-03-15 14:14:47 (GMT) |
commit | f81c7c620816c8a89bc363903c29f338bf7d6162 (patch) | |
tree | 67c647f543ac69a49a31606c094f5c6796bd3f88 /generic | |
parent | a20d3aea075e2b3990de10e1637613c7278d6acc (diff) | |
download | tcl-f81c7c620816c8a89bc363903c29f338bf7d6162.zip tcl-f81c7c620816c8a89bc363903c29f338bf7d6162.tar.gz tcl-f81c7c620816c8a89bc363903c29f338bf7d6162.tar.bz2 |
fixes [1f40aa83c552f597]: suppress integer-overflow trapping (atm, GCC "trapv" only) for intended pieces, avoid unexpected app-crash;
test cases (knownBug) reverted.
Diffstat (limited to 'generic')
-rw-r--r-- | generic/tclClockFmt.c | 9 | ||||
-rw-r--r-- | generic/tclDate.c | 9 | ||||
-rw-r--r-- | generic/tclGetDate.y | 9 |
3 files changed, 27 insertions, 0 deletions
diff --git a/generic/tclClockFmt.c b/generic/tclClockFmt.c index c216d34..66dbf6b 100644 --- a/generic/tclClockFmt.c +++ b/generic/tclClockFmt.c @@ -56,6 +56,11 @@ static void ClockFrmScnFinalize(void *clientData); *---------------------------------------------------------------------- */ +/* int overflows may happens here (expected case) */ +#if defined(__GNUC__) || defined(__GNUG__) +# pragma GCC optimize("no-trapv") +#endif + static inline int _str2int( int *out, @@ -113,6 +118,10 @@ _str2wideInt( *out = val; return TCL_OK; } + +#if defined(__GNUC__) || defined(__GNUG__) +# pragma GCC reset_options +#endif /* *---------------------------------------------------------------------- diff --git a/generic/tclDate.c b/generic/tclDate.c index 1614bb0..10f2151 100644 --- a/generic/tclDate.c +++ b/generic/tclDate.c @@ -2499,6 +2499,11 @@ LookupWord( return tID; } +/* int overflows may happens here (expected case) */ +#if defined(__GNUC__) || defined(__GNUG__) +# pragma GCC optimize("no-trapv") +#endif + static int TclDatelex( YYSTYPE* yylvalPtr, @@ -2636,6 +2641,10 @@ TclDatelex( } while (Count > 0); } } + +#if defined(__GNUC__) || defined(__GNUG__) +# pragma GCC reset_options +#endif int TclClockFreeScan( diff --git a/generic/tclGetDate.y b/generic/tclGetDate.y index 0bf16e8..b0a8f85 100644 --- a/generic/tclGetDate.y +++ b/generic/tclGetDate.y @@ -875,6 +875,11 @@ LookupWord( return tID; } +/* int overflows may happens here (expected case) */ +#if defined(__GNUC__) || defined(__GNUG__) +# pragma GCC optimize("no-trapv") +#endif + static int TclDatelex( YYSTYPE* yylvalPtr, @@ -1012,6 +1017,10 @@ TclDatelex( } while (Count > 0); } } + +#if defined(__GNUC__) || defined(__GNUG__) +# pragma GCC reset_options +#endif int TclClockFreeScan( |