File tree Expand file tree Collapse file tree 4 files changed +16
-2
lines changed Expand file tree Collapse file tree 4 files changed +16
-2
lines changed Original file line number Diff line number Diff line change @@ -216,6 +216,13 @@ void ansi_c_convert_typet::read_rec(const typet &type)
216
216
{
217
217
c_storage_spec.alias =type.subtype ().get (ID_value);
218
218
}
219
+ else if (type.id ()==ID_pointer)
220
+ {
221
+ // pointers have a width, much like integers
222
+ pointer_typet tmp=to_pointer_type (type);
223
+ tmp.set_width (config.ansi_c .pointer_width );
224
+ other.push_back (tmp);
225
+ }
219
226
else
220
227
other.push_back (type);
221
228
}
Original file line number Diff line number Diff line change @@ -76,7 +76,10 @@ void c_typecheck_baset::typecheck_type(typet &type)
76
76
else if (type.id ()==ID_array)
77
77
typecheck_array_type (to_array_type (type));
78
78
else if (type.id ()==ID_pointer)
79
+ {
79
80
typecheck_type (type.subtype ());
81
+ INVARIANT (!type.get (ID_width).empty (), " pointers must have width" );
82
+ }
80
83
else if (type.id ()==ID_struct ||
81
84
type.id ()==ID_union)
82
85
typecheck_compound_type (to_struct_union_type (type));
Original file line number Diff line number Diff line change 14
14
#include < util/source_location.h>
15
15
#include < util/simplify_expr.h>
16
16
#include < util/c_types.h>
17
+ #include < util/config.h>
17
18
18
19
#include < ansi-c/c_qualifiers.h>
19
20
@@ -81,6 +82,9 @@ void cpp_typecheckt::typecheck_type(typet &type)
81
82
// the pointer might have a qualifier, but do subtype first
82
83
typecheck_type (type.subtype ());
83
84
85
+ // we add a width, much like with integers
86
+ to_pointer_type (type).set_width (config.ansi_c .pointer_width );
87
+
84
88
// Check if it is a pointer-to-member
85
89
if (type.find (" to-member" ).is_not_nil ())
86
90
{
Original file line number Diff line number Diff line change @@ -296,12 +296,12 @@ signedbv_typet pointer_diff_type()
296
296
297
297
pointer_typet pointer_type (const typet &subtype)
298
298
{
299
- return pointer_typet (subtype);
299
+ return pointer_typet (subtype, config. ansi_c . pointer_width );
300
300
}
301
301
302
302
reference_typet reference_type (const typet &subtype)
303
303
{
304
- return reference_typet (subtype);
304
+ return reference_typet (subtype, config. ansi_c . pointer_width );
305
305
}
306
306
307
307
typet void_type ()
You can’t perform that action at this time.
0 commit comments