ignore size of arrays on ptr-to-array conversions

This commit is contained in:
Daniel Kroening 2018-05-26 17:13:01 +01:00
parent 8cc1848e5c
commit 5ca741056d
3 changed files with 23 additions and 0 deletions

View File

@ -0,0 +1,8 @@
int (*ptr2)[2];
int (*ptrX)[];
int main()
{
ptrX=ptr2;
ptr2=ptrX;
}

View File

@ -0,0 +1,8 @@
CORE
conversion.c
--verbosity 3
^EXIT=0$
^SIGNAL=0$
--
incompatible pointer types
^CONVERSION ERROR$

View File

@ -543,6 +543,13 @@ void c_typecastt::implicit_typecast_followed(
// Also generous: between any to scalar types it's ok.
// We should probably check the size.
}
else if(src_sub.id()==ID_array &&
dest_sub.id()==ID_array &&
base_type_eq(src_sub.subtype(), dest_sub.subtype(), ns))
{
// we ignore the size of the top-level array
// in the case of pointers to arrays
}
else
warnings.push_back("incompatible pointer types");