Skip to content

String literals treated as unchecked without -alltypes #470

Open
@john-h-kastner

Description

@john-h-kastner

When converting without -alltypes, the constraint variable associated with string literals will solve to WILD because there is a constraint with NTARR. It makes sense to let string literals be checked because code like the following is accepted by CheckedC.

void foo(void) _Checked {
  _Ptr<char> a = "test";
}

Making string literals unchecked also results in many unnecessary casts being inserted for benchmark programs such as vsftpd.

void foo(char* x) { }
void bar(void) {
  foo("test");
}
void foo(_Ptr<char> x) _Checked { }
void bar(void) _Checked {
  foo(_Assume_bounds_cast<_Ptr<char>>("test"));
}

When combine with issue #469, the extra cast causes a compile error for -addcr.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions