diff options
author | Andreas Rumpf <rumpf_a@web.de> | 2020-03-12 23:44:33 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-03-12 23:44:33 +0100 |
commit | a6682de0045468ae1d15afbd2fd5378960e15eb7 (patch) | |
tree | 85bca8b0a220e6295fe60bfc45487197acaf8b8d /lib/system/mm/boehm.nim | |
parent | 14b2354b7da36041ca046e60e833b5be9a04f1e4 (diff) | |
download | Nim-a6682de0045468ae1d15afbd2fd5378960e15eb7.tar.gz |
catchable defects (#13626)
* allow defects to be caught even for --exceptions:goto (WIP) * implemented the new --panics:on|off switch; refs https://github.com/nim-lang/RFCs/issues/180 * new implementation for integer overflow checking * produce a warning if a user-defined exception type inherits from Exception directly * applied Timothee's suggestions; improved the documentation and replace the term 'checked runtime check' by 'panic' * fixes #13627 * don't inherit from Exception directly
Diffstat (limited to 'lib/system/mm/boehm.nim')
-rw-r--r-- | lib/system/mm/boehm.nim | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/lib/system/mm/boehm.nim b/lib/system/mm/boehm.nim index d02d52b52..a8b0e17b4 100644 --- a/lib/system/mm/boehm.nim +++ b/lib/system/mm/boehm.nim @@ -101,10 +101,12 @@ proc newObj(typ: PNimType, size: int): pointer {.compilerproc.} = else: result = alloc(size) if typ.finalizer != nil: boehmRegisterFinalizer(result, boehmgc_finalizer, typ.finalizer, nil, nil) +{.push overflowChecks: on.} proc newSeq(typ: PNimType, len: int): pointer {.compilerproc.} = - result = newObj(typ, addInt(mulInt(len, typ.base.size), GenericSeqSize)) + result = newObj(typ, len * typ.base.size + GenericSeqSize) cast[PGenericSeq](result).len = len cast[PGenericSeq](result).reserved = len +{.pop.} proc growObj(old: pointer, newsize: int): pointer = result = realloc(old, newsize) |