diff options
author | Tristan Gingold <tgingold@free.fr> | 2022-12-16 07:44:22 +0100 |
---|---|---|
committer | Tristan Gingold <tgingold@free.fr> | 2022-12-16 18:22:43 +0100 |
commit | ecbca396df7cb437e9ed112cdf0c5c2035d43885 (patch) | |
tree | fc5d39bc54cdc96dd9a409753d005a72966587e9 | |
parent | 27c2badb6d3d0f3e84b5bfe53770bd911679db42 (diff) | |
download | ghdl-ecbca396df7cb437e9ed112cdf0c5c2035d43885.tar.gz ghdl-ecbca396df7cb437e9ed112cdf0c5c2035d43885.tar.bz2 ghdl-ecbca396df7cb437e9ed112cdf0c5c2035d43885.zip |
synth-vhdl_stmts: handle impure functions.
Fix #2270
-rw-r--r-- | src/synth/synth-vhdl_stmts.adb | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/src/synth/synth-vhdl_stmts.adb b/src/synth/synth-vhdl_stmts.adb index 8c521cc77..5268e28d8 100644 --- a/src/synth/synth-vhdl_stmts.adb +++ b/src/synth/synth-vhdl_stmts.adb @@ -2623,7 +2623,14 @@ package body Synth.Vhdl_Stmts is if Is_Error (Sub_Inst) then Res := No_Valtyp; else - if not Is_Func then + -- If the subprogram is not pure, clear the const flag. + if Is_Func then + -- For functions. + if Ctxt /= null and then not Get_Pure_Flag (Imp) then + Set_Instance_Const (Sub_Inst, False); + end if; + else + -- For procedures. if Ctxt /= null and then Get_Purity_State (Imp) /= Pure then Set_Instance_Const (Sub_Inst, False); end if; |