You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
While testing another issue, I made a typo and initialized a checked-pointer local variable with itself and was surprised to find that that compiles without error. An example:
#pragma CHECKED_SCOPE on
intmain(void) {
{
// Put an invalid pointer in the memory that will be reused by `p`.longx=1;
}
{
_Ptr<char>p=p;
(*p)++; // SIGSEGV
}
return0;
}
Maybe this warning just needs to be made into an error when it occurs in the initializer of a checked-pointer variable?
Apparently that isn't good enough. The following produces no warning with -Wall:
#pragma CHECKED_SCOPE on
_Ptr<char>foo(_Ptr<_Ptr<char>> pp) {
return*pp;
}
intmain(void) {
{
// Put an invalid pointer in the memory that will be reused by `p`.longx=1;
}
{
_Ptr<char>p=foo(&p);
(*p)++; // SIGSEGV
}
return0;
}
I guess we should disallow any use of p in its own initializer.
The test 3C/multiple_tu.c fails only on Windows. The problem is the test script. The script generates a command file in JSON format by piping a small generated Python program into the Python interpreter. The program contains strings for file names. On Windows, the directory separator is a backslash character (`\`). The backslash is interpreted as a string escape character. This results in JSON with incorrect paths. Use raw Python strings for the file names so that Python leaves them alone.
While testing another issue, I made a typo and initialized a checked-pointer local variable with itself and was surprised to find that that compiles without error. An example:
With
-Wall
, I get a compiler warning:Maybe this warning just needs to be made into an error when it occurs in the initializer of a checked-pointer variable?
The text was updated successfully, but these errors were encountered: