panics:on (#218)

This commit is contained in:
Mamy Ratsimbazafy 2023-02-07 13:11:15 +01:00 committed by GitHub
parent cbb454fff1
commit a11fca9c60
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 4 deletions

View File

@ -332,6 +332,7 @@ template setupCommand(): untyped {.dirty.} =
# Not available in MinGW https://github.com/libressl-portable/portable/issues/54 # Not available in MinGW https://github.com/libressl-portable/portable/issues/54
flags &= " --passC:-fstack-protector-strong" flags &= " --passC:-fstack-protector-strong"
let command = "nim " & lang & cc & " -d:release " & flags & let command = "nim " & lang & cc & " -d:release " & flags &
" --panics:on " & # Defects are not catchable
" --verbosity:0 --outdir:build/testsuite -r --hints:off --warnings:off " & " --verbosity:0 --outdir:build/testsuite -r --hints:off --warnings:off " &
" --nimcache:nimcache/" & path & " " & " --nimcache:nimcache/" & path & " " &
path path
@ -363,6 +364,7 @@ template setupBench(): untyped {.dirty.} =
if not useAsm: if not useAsm:
cc &= " -d:CttASM=false" cc &= " -d:CttASM=false"
let command = "nim " & lang & cc & let command = "nim " & lang & cc &
" --panics:on " & # Defects are not catchable
" -d:danger --verbosity:0 -o:build/bench/" & benchName & "_" & compiler & "_" & (if useAsm: "useASM" else: "noASM") & " -d:danger --verbosity:0 -o:build/bench/" & benchName & "_" & compiler & "_" & (if useAsm: "useASM" else: "noASM") &
" --nimcache:nimcache/benches/" & benchName & "_" & compiler & "_" & (if useAsm: "useASM" else: "noASM") & " --nimcache:nimcache/benches/" & benchName & "_" & compiler & "_" & (if useAsm: "useASM" else: "noASM") &
runFlag & "--hints:off --warnings:off benchmarks/" & benchName & ".nim" runFlag & "--hints:off --warnings:off benchmarks/" & benchName & ".nim"
@ -451,6 +453,7 @@ proc genDynamicBindings(bindingsName, prefixNimMain: string) =
# - heap-allocated strings for hex-string or decimal strings # - heap-allocated strings for hex-string or decimal strings
echo "Compiling dynamic library: bindings/generated/" & libName echo "Compiling dynamic library: bindings/generated/" & libName
exec "nim c -f " & flags & " --noMain -d:danger --app:lib --gc:arc " & exec "nim c -f " & flags & " --noMain -d:danger --app:lib --gc:arc " &
" --panics:on " & # Defects are not catchable
" --verbosity:0 --hints:off --warnings:off " & " --verbosity:0 --hints:off --warnings:off " &
" --nimMainPrefix:" & prefixNimMain & " --nimMainPrefix:" & prefixNimMain &
" --out:" & libName & " --outdir:bindings/generated " & " --out:" & libName & " --outdir:bindings/generated " &
@ -481,6 +484,7 @@ proc genStaticBindings(bindingsName, prefixNimMain: string) =
# - heap-allocated strings for hex-string or decimal strings # - heap-allocated strings for hex-string or decimal strings
echo "Compiling static library: bindings/generated/" & libName echo "Compiling static library: bindings/generated/" & libName
exec "nim c -f " & flags & " --noMain -d:danger --app:staticLib --gc:arc " & exec "nim c -f " & flags & " --noMain -d:danger --app:staticLib --gc:arc " &
" --panics:on " & # Defects are not catchable
" --verbosity:0 --hints:off --warnings:off " & " --verbosity:0 --hints:off --warnings:off " &
" --nimMainPrefix:" & prefixNimMain & " --nimMainPrefix:" & prefixNimMain &
" --out:" & libName & " --outdir:bindings/generated " & " --out:" & libName & " --outdir:bindings/generated " &

View File

@ -114,8 +114,7 @@ func eth_evm_ecadd*(
# Auto-pad with zero # Auto-pad with zero
var padded: array[128, byte] var padded: array[128, byte]
let lastIdx = min(inputs.len, 128) - 1 padded.copy(0, inputs, 0, min(inputs.len, 128))
padded[0 .. lastIdx] = inputs.toOpenArray(0, lastIdx)
var P{.noInit.}, Q{.noInit.}, R{.noInit.}: ECP_ShortW_Prj[Fp[BN254_Snarks], G1] var P{.noInit.}, Q{.noInit.}, R{.noInit.}: ECP_ShortW_Prj[Fp[BN254_Snarks], G1]
@ -171,8 +170,7 @@ func eth_evm_ecmul*(
# Auto-pad with zero # Auto-pad with zero
var padded: array[128, byte] var padded: array[128, byte]
let lastIdx = min(inputs.len, 128) - 1 padded.copy(0, inputs, 0, min(inputs.len, 128))
padded[0 .. lastIdx] = inputs.toOpenArray(0, lastIdx)
var P{.noInit.}: ECP_ShortW_Prj[Fp[BN254_Snarks], G1] var P{.noInit.}: ECP_ShortW_Prj[Fp[BN254_Snarks], G1]