Skip to content

String.format produces errors in set_to #1202

Closed
@allredj

Description

@allredj

The tests introduced in #1105 (but almost certainly elsewhere) generate type inconsistencies.
For instance, the test cbmc/regression/strings-smoke-tests/java_format2/test.desc:

public class test
{
    public static String main(String str)
    {
        String s = String.format("foo %s", str);
        assert(s.equals("foo ".concat(str)));
        assert(!s.equals("foo ".concat(str)));
        return s;
    }
}

with the following command line:

cbmc test.class --refine-strings --string-max-length 20 --verbosity 9

generates the following warnings:

converting SSA
ignoring tmp_object$18!0#1 == &dynamic_object3 [inconsistent types]
ignoring tmp_object$33!0#1 == &dynamic_object4 [inconsistent types]
ignoring tmp_object$48!0#1 == &dynamic_object5 [inconsistent types]
ignoring tmp_object$63!0#1 == &dynamic_object6 [inconsistent types]
ignoring tmp_object$78!0#1 == &dynamic_object7 [inconsistent types]
ignoring tmp_object$93!0#1 == &dynamic_object8 [inconsistent types]
ignoring tmp_object$108!0#1 == &dynamic_object9 [inconsistent types]
ignoring tmp_object$123!0#1 == &dynamic_object10 [inconsistent types]
ignoring tmp_object$138!0#1 == &dynamic_object11 [inconsistent types]
ignoring tmp_object$153!0#1 == &dynamic_object12 [inconsistent types]

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions