Skip to content

CBMC fails to match _Generic arms for pointers to arrays #8690

@archigup

Description

@archigup

A generic selection on a value of type int(*)[5] should match an arm for int(*)[] but this is not the case with cbmc.

In order to reproduce:

test.c:

#include <assert.h>
#include <stdbool.h>

int main(void) {
    int arr[5];
    assert(_Generic(&arr, int(*)[]: true));
}

output:

$ gcc test.c -o test
$ ./test
$ cbmc test.c 
CBMC version 6.7.1 (n/a) 64-bit x86_64 linux
Type-checking test
file test.c line 6 function main: unmatched generic selection: signed int (*)[5l]
CONVERSION ERROR
6$ 

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions