-
Notifications
You must be signed in to change notification settings - Fork 5
Work around compiler bug on assignment from itype with nested _Nt_array_ptr
to fully checked type
#725
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
The problem may just be that Correction to what I wrote before: Unfortunately, there's no standard header that C programs are expected to include before accessing |
This could be a Checked C compiler bug. This is an error: char ** p : itype(_Nt_array_ptr<_Nt_array_ptr<char>>);
void test(void) {
_Array_ptr<_Nt_array_ptr<char>> q = p;
} while this isn't: char * p : itype(_Nt_array_ptr<char>);
void test(void) {
_Array_ptr<char> q = p;
} |
Good catch on the compiler bug. I did some more testing, and I'm pretty sure that either the compiler bug or the lack of In John's examples above, if I put void environ_test(void) _Checked {
_Array_ptr<_Nt_array_ptr<char>> p_env = environ;
} then the error still occurs. If I add I suspect the compiler bug has to do with the highly technical rules for itypes in section 6.3.8 of the Checked C specification. IIUC, the general idea is that in an unchecked scope, the unchecked side of the itype is used, but the bounds information from the itype is made available to the bounds check. I suspect the problem is that the compiler is keeping only the top-level bounds information, not the bounds information of the inner |
Some more thoughts: Re the itype compiler bug: It looks like a C-style cast works around the problem, just as in checkedc#614: char ** p : itype(_Nt_array_ptr<_Nt_array_ptr<char>>);
void test(void) {
// Error
_Array_ptr<_Nt_array_ptr<char>> q = p;
// No error
_Array_ptr<_Nt_array_ptr<char>> q_cast = (_Array_ptr<_Nt_array_ptr<char>>) p;
} So that's probably what 3C should do unless/until the compiler bug is fixed, analogously to #545. Re having an itype for The other point here is why 3C is trying to assign Now that I've dispatched the sub-issues related to having an itype for |
_Nt_array_ptr
to fully checked type
This error appears in our vsftpd benchmarks (-alltypes)
It's related to a global variable with an itype inside an unwritable file, and the local copy and usage is inside an
#ifdef
.The error needs to be explored more, but this issue us being used as a link target from the benchmark summary that acknowledges the problem.
The text was updated successfully, but these errors were encountered: