diff options
author | Tristan Gingold <tgingold@free.fr> | 2018-11-23 04:28:44 +0100 |
---|---|---|
committer | Tristan Gingold <tgingold@free.fr> | 2018-11-23 04:29:21 +0100 |
commit | f2c4cfadb13dd5eef1979069317e5c6ee224c908 (patch) | |
tree | 501db6bae01657d120a033f3ff2414b011e9135e /src/grt/grt-options.adb | |
parent | 3d81a74f66c2440ebde7efc64415d6c5510e94ee (diff) | |
download | ghdl-f2c4cfadb13dd5eef1979069317e5c6ee224c908.tar.gz ghdl-f2c4cfadb13dd5eef1979069317e5c6ee224c908.tar.bz2 ghdl-f2c4cfadb13dd5eef1979069317e5c6ee224c908.zip |
Add --max-stack-alloc option, check stack allocation of complex object.
Fix #692
Diffstat (limited to 'src/grt/grt-options.adb')
-rw-r--r-- | src/grt/grt-options.adb | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/src/grt/grt-options.adb b/src/grt/grt-options.adb index 5b154e4a5..d93ad9e58 100644 --- a/src/grt/grt-options.adb +++ b/src/grt/grt-options.adb @@ -56,6 +56,7 @@ package body Grt.Options is P (" X is expressed as a time value, without spaces: 1ns, ps..."); P (" --stop-delta=X stop the simulation cycle after X delta"); P (" --expect-failure invert exit status"); + P (" --max-stack-alloc=X error if variables are larger than X KB"); P (" --no-run do not simulate, only elaborate"); P (" --unbuffered disable buffering on stdout, stderr and"); P (" files opened in write or append mode (TEXTIO)."); @@ -272,6 +273,21 @@ package body Grt.Options is Warning ("option --stack-size is deprecated"); elsif Len >= 17 and then Option (1 .. 17) = "--stack-max-size=" then Warning ("option --stack-max-size is deprecated"); + elsif Len >= 18 and then Option (1 .. 18) = "--max-stack-alloc=" then + declare + Ok : Boolean; + Pos : Natural; + Val : Integer_64; + begin + Extract_Integer (Option (19 .. Len), Ok, Val, Pos); + if not Ok or else Pos <= Len then + Error_S ("bad value in '"); + Diag_C (Option); + Error_E ("'"); + else + Lib.Max_Stack_Allocation := Ghdl_Index_Type (Val * 1024); + end if; + end; elsif Len >= 11 and then Option (1 .. 11) = "--activity=" then if Option (12 .. Len) = "none" then Flag_Activity := Activity_None; |