diff --git a/regression/goto-instrument/const-struct1/test.desc b/regression/goto-instrument/const-struct1/test.desc index 40306e23153..8575824dbcb 100644 --- a/regression/goto-instrument/const-struct1/test.desc +++ b/regression/goto-instrument/const-struct1/test.desc @@ -1,7 +1,7 @@ -KNOWNBUG +CORE main.c --show-symbol-table -^Type\.*: struct struct_tag_name$ +^Type\.*: const struct struct_tag_name$ ^Type\.*: const double$ ^EXIT=0$ ^SIGNAL=0$ diff --git a/regression/goto-instrument/const-struct2/main.c b/regression/goto-instrument/const-struct2/main.c new file mode 100644 index 00000000000..adf97faf658 --- /dev/null +++ b/regression/goto-instrument/const-struct2/main.c @@ -0,0 +1,10 @@ + +int main() +{ + const struct struct_tag_name { + int x; + float y; + } my_struct_var = {.x = 1, .y = 3.15}; + const double z = 4; + return 0; +} diff --git a/regression/goto-instrument/const-struct2/test.desc b/regression/goto-instrument/const-struct2/test.desc new file mode 100644 index 00000000000..8575824dbcb --- /dev/null +++ b/regression/goto-instrument/const-struct2/test.desc @@ -0,0 +1,9 @@ +CORE +main.c +--show-symbol-table +^Type\.*: const struct struct_tag_name$ +^Type\.*: const double$ +^EXIT=0$ +^SIGNAL=0$ +-- +^warning: ignoring diff --git a/regression/goto-instrument/const-struct3/main.c b/regression/goto-instrument/const-struct3/main.c new file mode 100644 index 00000000000..fda2dc345f6 --- /dev/null +++ b/regression/goto-instrument/const-struct3/main.c @@ -0,0 +1,13 @@ + +struct struct_tag_name +{ + int x; + float y; +}; + +int main() +{ + const struct struct_tag_name my_struct_var = {.x = 1, .y = 3.15}; + const double z = 4; + return 0; +} diff --git a/regression/goto-instrument/const-struct3/test.desc b/regression/goto-instrument/const-struct3/test.desc new file mode 100644 index 00000000000..430dcf89321 --- /dev/null +++ b/regression/goto-instrument/const-struct3/test.desc @@ -0,0 +1,9 @@ +CORE +main.c +--dump-c +^\s*const struct struct_tag_name my_struct_var +^\s*const double z +^EXIT=0$ +^SIGNAL=0$ +-- +^warning: ignoring diff --git a/regression/goto-instrument/const-union1/main.c b/regression/goto-instrument/const-union1/main.c new file mode 100644 index 00000000000..1ba8ba29675 --- /dev/null +++ b/regression/goto-instrument/const-union1/main.c @@ -0,0 +1,13 @@ + +union union_tag_name +{ + int x; + float y; +}; + +int main() +{ + const union union_tag_name my_union_var = {.y = 3.15}; + const double z = 4; + return 0; +} diff --git a/regression/goto-instrument/const-union1/test.desc b/regression/goto-instrument/const-union1/test.desc new file mode 100644 index 00000000000..01de23cf56d --- /dev/null +++ b/regression/goto-instrument/const-union1/test.desc @@ -0,0 +1,9 @@ +CORE +main.c +--show-symbol-table +^Type\.*: const union union_tag_name$ +^Type\.*: const double$ +^EXIT=0$ +^SIGNAL=0$ +-- +^warning: ignoring diff --git a/regression/goto-instrument/volatile-struct1/main.c b/regression/goto-instrument/volatile-struct1/main.c new file mode 100644 index 00000000000..7f788eacc21 --- /dev/null +++ b/regression/goto-instrument/volatile-struct1/main.c @@ -0,0 +1,13 @@ + +struct struct_tag_name +{ + int x; + float y; +}; + +int main() +{ + volatile struct struct_tag_name my_struct_var = {.x = 1, .y = 3.15}; + const double z = 4; + return 0; +} diff --git a/regression/goto-instrument/volatile-struct1/test.desc b/regression/goto-instrument/volatile-struct1/test.desc new file mode 100644 index 00000000000..ced4d5c8ddd --- /dev/null +++ b/regression/goto-instrument/volatile-struct1/test.desc @@ -0,0 +1,9 @@ +CORE +main.c +--show-symbol-table +^Type\.*: volatile struct struct_tag_name$ +^Type\.*: const double$ +^EXIT=0$ +^SIGNAL=0$ +-- +^warning: ignoring diff --git a/src/ansi-c/c_typecheck_type.cpp b/src/ansi-c/c_typecheck_type.cpp index 879fbc34efc..3ee77eba3b0 100644 --- a/src/ansi-c/c_typecheck_type.cpp +++ b/src/ansi-c/c_typecheck_type.cpp @@ -820,7 +820,9 @@ void c_typecheck_baset::typecheck_compound_type(struct_union_typet &type) symbol_type.add_source_location()=type.source_location(); symbol_type.set_identifier(identifier); + c_qualifierst original_qualifiers(type); type.swap(symbol_type); + original_qualifiers.write(type); } /*******************************************************************\