Skip to content

Commit d8371f9

Browse files
Make sure code_typet is fully constructed
The existence of the parameters and return_type properties may depend on whether parameters() or return_type() has been called or not, which can lead to unexpectedly unequal instructions in goto programs.
1 parent 0a6c908 commit d8371f9

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

src/util/std_types.h

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -760,6 +760,10 @@ class code_typet:public typet
760760
public:
761761
code_typet():typet(ID_code)
762762
{
763+
// make sure these properties are always there to avoid problems
764+
// with irept comparisons
765+
add(ID_parameters);
766+
add_type(ID_return_type);
763767
}
764768

765769
// used to be argumentt -- now uses standard terminology
@@ -858,13 +862,13 @@ class code_typet:public typet
858862
add(ID_parameters).remove(ID_ellipsis);
859863
}
860864

861-
typedef std::vector<parametert> parameterst;
862-
863865
const typet &return_type() const
864866
{
865867
return find_type(ID_return_type);
866868
}
867869

870+
typedef std::vector<parametert> parameterst;
871+
868872
typet &return_type()
869873
{
870874
return add_type(ID_return_type);

0 commit comments

Comments
 (0)