summaryrefslogtreecommitdiffstats
path: root/generic
diff options
context:
space:
mode:
authorsebres <sebres@users.sourceforge.net>2024-03-15 14:14:47 (GMT)
committersebres <sebres@users.sourceforge.net>2024-03-15 14:14:47 (GMT)
commitf81c7c620816c8a89bc363903c29f338bf7d6162 (patch)
tree67c647f543ac69a49a31606c094f5c6796bd3f88 /generic
parenta20d3aea075e2b3990de10e1637613c7278d6acc (diff)
downloadtcl-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.c9
-rw-r--r--generic/tclDate.c9
-rw-r--r--generic/tclGetDate.y9
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(