@@ -69,12 +69,13 @@ exprt c_typecheck_baset::do_initializer_rec(
6969 if (value.id ()==ID_initializer_list)
7070 return do_initializer_list (value, type, force_constant);
7171
72- if (value.id ()==ID_array &&
73- value.get_bool (ID_C_string_constant) &&
74- full_type.id ()==ID_array &&
75- (full_type.subtype ().id ()==ID_signedbv ||
76- full_type.subtype ().id ()==ID_unsignedbv) &&
77- full_type.subtype ().get (ID_width)==value.type ().subtype ().get (ID_width))
72+ if (
73+ value.id () == ID_array && value.get_bool (ID_C_string_constant) &&
74+ full_type.id () == ID_array &&
75+ (full_type.subtype ().id () == ID_signedbv ||
76+ full_type.subtype ().id () == ID_unsignedbv) &&
77+ to_bitvector_type (full_type.subtype ()).get_width () ==
78+ to_bitvector_type (value.type ().subtype ()).get_width ())
7879 {
7980 exprt tmp=value;
8081
@@ -130,11 +131,12 @@ exprt c_typecheck_baset::do_initializer_rec(
130131 return tmp;
131132 }
132133
133- if (value.id ()==ID_string_constant &&
134- full_type.id ()==ID_array &&
135- (full_type.subtype ().id ()==ID_signedbv ||
136- full_type.subtype ().id ()==ID_unsignedbv) &&
137- full_type.subtype ().get (ID_width)==char_type ().get (ID_width))
134+ if (
135+ value.id () == ID_string_constant && full_type.id () == ID_array &&
136+ (full_type.subtype ().id () == ID_signedbv ||
137+ full_type.subtype ().id () == ID_unsignedbv) &&
138+ to_bitvector_type (full_type.subtype ()).get_width () ==
139+ char_type ().get_width ())
138140 {
139141 // will go away, to be replaced by the above block
140142
@@ -876,11 +878,12 @@ exprt c_typecheck_baset::do_initializer_list(
876878
877879 // 6.7.9, 14: An array of character type may be initialized by a character
878880 // string literal or UTF-8 string literal, optionally enclosed in braces.
879- if (value.operands ().size ()>=1 &&
880- value.op0 ().id ()==ID_string_constant &&
881- (full_type.subtype ().id ()==ID_signedbv ||
882- full_type.subtype ().id ()==ID_unsignedbv) &&
883- full_type.subtype ().get (ID_width)==char_type ().get (ID_width))
881+ if (
882+ value.operands ().size () >= 1 && value.op0 ().id () == ID_string_constant &&
883+ (full_type.subtype ().id () == ID_signedbv ||
884+ full_type.subtype ().id () == ID_unsignedbv) &&
885+ to_bitvector_type (full_type.subtype ()).get_width () ==
886+ char_type ().get_width ())
884887 {
885888 if (value.operands ().size ()>1 )
886889 {
0 commit comments