Skip to content
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

[CN] cannot use prefix increment with size_t in a loop #678

Open
peterohanley opened this issue Oct 31, 2024 · 0 comments
Open

[CN] cannot use prefix increment with size_t in a loop #678

peterohanley opened this issue Oct 31, 2024 · 0 comments
Labels
base typing bug Something isn't working cn

Comments

@peterohanley
Copy link

#include <stdlib.h>
#include <stdint.h>

void f(void)
{
    for (size_t i = 0; i < 10; i++);
    for (size_t i = 0; i < 10; ++i);
}
void g(void)
{
    for (uint64_t i = 0; i < 10; i++);
    for (uint64_t i = 0; i < 10; ++i);
}
% cn verify for_loop_u32.c
[1/2]: f -- fail
[2/2]: g -- pass
for_loop_u32.c:7:32: error: Mismatched types.
    for (size_t i = 0; i < 10; ++i);
                               ^~~ 
Expected value of type 'u64' but found value of type 'u32'

cerberus defines size_t as __cerbty_size_t and uint64_t as unsigned long long which I guess is where the discrepancy comes from.

@dc-mak dc-mak added cn bug Something isn't working base typing labels Nov 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
base typing bug Something isn't working cn
Projects
None yet
Development

No branches or pull requests

2 participants