diff options
author | Tristan Gingold <tgingold@free.fr> | 2019-05-07 18:45:33 +0200 |
---|---|---|
committer | Tristan Gingold <tgingold@free.fr> | 2019-05-07 18:45:33 +0200 |
commit | a2c0447aeb1e1b3fca1d84716a2a97a5f65d3c30 (patch) | |
tree | e6966abbf56ad36ed80ea5301240a25aef54ce39 /src/vhdl/vhdl-evaluation.adb | |
parent | cebafc9a8bcc4664dd00de5efad97dd0b709d3a9 (diff) | |
download | ghdl-a2c0447aeb1e1b3fca1d84716a2a97a5f65d3c30.tar.gz ghdl-a2c0447aeb1e1b3fca1d84716a2a97a5f65d3c30.tar.bz2 ghdl-a2c0447aeb1e1b3fca1d84716a2a97a5f65d3c30.zip |
vhdl: Add a warning for null range in discrete type declaration.
For issue #810
Diffstat (limited to 'src/vhdl/vhdl-evaluation.adb')
-rw-r--r-- | src/vhdl/vhdl-evaluation.adb | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/src/vhdl/vhdl-evaluation.adb b/src/vhdl/vhdl-evaluation.adb index 65d099a42..6363411aa 100644 --- a/src/vhdl/vhdl-evaluation.adb +++ b/src/vhdl/vhdl-evaluation.adb @@ -3487,6 +3487,20 @@ package body Vhdl.Evaluation is end case; end Eval_Discrete_Type_Length; + function Eval_Is_Null_Discrete_Range (Rng : Iir) return Boolean + is + Left, Right : Iir_Int64; + begin + Left := Eval_Pos (Get_Left_Limit (Rng)); + Right := Eval_Pos (Get_Right_Limit (Rng)); + case Get_Direction (Rng) is + when Iir_To => + return Right < Left; + when Iir_Downto => + return Left < Right; + end case; + end Eval_Is_Null_Discrete_Range; + function Eval_Pos (Expr : Iir) return Iir_Int64 is begin case Get_Kind (Expr) is |