diff options
author | Tristan Gingold | 2015-05-20 21:42:09 +0200 |
---|---|---|
committer | Tristan Gingold | 2015-05-20 21:42:09 +0200 |
commit | 8b96a998627521e45e92b44a52d09853c73ca625 (patch) | |
tree | 6ea20e7c1eb2b96a31649c5a10e7ed8d95035624 | |
parent | 338d9cce77d60cb34cf02c6cab9ceb4a2918938f (diff) | |
download | ghdl-8b96a998627521e45e92b44a52d09853c73ca625.tar.gz ghdl-8b96a998627521e45e92b44a52d09853c73ca625.tar.bz2 ghdl-8b96a998627521e45e92b44a52d09853c73ca625.zip |
Fix crash in assert translation for overflow literal.
Fix ticket 75.
-rw-r--r-- | src/vhdl/evaluation.adb | 3 | ||||
-rw-r--r-- | src/vhdl/iirs_utils.adb | 5 | ||||
-rw-r--r-- | src/vhdl/iirs_utils.ads | 4 | ||||
-rw-r--r-- | src/vhdl/translate/trans-chap8.adb | 4 |
4 files changed, 14 insertions, 2 deletions
diff --git a/src/vhdl/evaluation.adb b/src/vhdl/evaluation.adb index b1adbbc..76464a7 100644 --- a/src/vhdl/evaluation.adb +++ b/src/vhdl/evaluation.adb @@ -1651,7 +1651,8 @@ package body Evaluation is return Build_Enumeration (Iir_Index32 (I), Expr); end if; end loop; - Warning_Msg_Sem ("value """ & Value & """ not in enumeration", Expr); + Warning_Msg_Sem ("value """ & Value & """ not in enumeration " + & Disp_Node (Enum), Expr); return Build_Overflow (Expr); end Build_Enumeration_Value; diff --git a/src/vhdl/iirs_utils.adb b/src/vhdl/iirs_utils.adb index 5fa9987..4df49b4 100644 --- a/src/vhdl/iirs_utils.adb +++ b/src/vhdl/iirs_utils.adb @@ -51,6 +51,11 @@ package body Iirs_Utils is return Get_Kind (N) = Iir_Kind_Error; end Is_Error; + function Is_Overflow_Literal (N : Iir) return Boolean is + begin + return Get_Kind (N) = Iir_Kind_Overflow_Literal; + end Is_Overflow_Literal; + function Get_Operator_Name (Op : Iir) return Name_Id is begin case Get_Kind (Op) is diff --git a/src/vhdl/iirs_utils.ads b/src/vhdl/iirs_utils.ads index 3d74aa3..96ac91d 100644 --- a/src/vhdl/iirs_utils.ads +++ b/src/vhdl/iirs_utils.ads @@ -31,6 +31,10 @@ package Iirs_Utils is function Is_Error (N : Iir) return Boolean; pragma Inline (Is_Error); + -- Return True iff N is an overflow_literal node. + function Is_Overflow_Literal (N : Iir) return Boolean; + pragma Inline (Is_Overflow_Literal); + -- Find LIT in the list of identifiers or characters LIST. -- Return the literal (whose name is LIT) or null_iir if not found. function Find_Name_In_Chain (Chain: Iir; Lit: Name_Id) return Iir; diff --git a/src/vhdl/translate/trans-chap8.adb b/src/vhdl/translate/trans-chap8.adb index 16dc32b..283ffbc 100644 --- a/src/vhdl/translate/trans-chap8.adb +++ b/src/vhdl/translate/trans-chap8.adb @@ -701,7 +701,9 @@ package body Trans.Chap8 is end if; Expr := Get_Assertion_Condition (Stmt); - if Get_Expr_Staticness (Expr) = Locally then + if Get_Expr_Staticness (Expr) = Locally + and then not Is_Overflow_Literal (Expr) + then if Eval_Pos (Expr) = 1 then -- Assert TRUE is a noop. -- FIXME: generate a noop ? |