Skip to content

Preprocessor constants not properly handled. #646

Closed
@secure-sw-dev-bot

Description

@secure-sw-dev-bot

This issue was copied from checkedc/checkedc-clang#650


[This is a BUG]

Looks like checkedc-clang does not support preprocessor constants:

Consider the following code:

#include<stdio_checked.h>
void log_write(_Ptr<const char> func) {
    char pre[256];
    snprintf(pre, sizeof(pre), "%s", func);
    printf("%s", pre);
}
int main(void) {
   log_write("This Works");
   log_write(__func__);
}
$ clang -c pre.c 
pre.c:9:14: error: expression has unknown bounds, cast to ptr<T> expects source to have bounds
   log_write(__func__);
             ^~~~~~~~
1 error generated.

Note that, log_write("This Works"); checks out.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions