Skip to content

Commit 2f54a9d

Browse files
author
Daniel Kroening
committed
ignore size of arrays on ptr-to-array conversions
1 parent 8cc1848 commit 2f54a9d

File tree

3 files changed

+23
-0
lines changed

3 files changed

+23
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
int (*ptr2)[2];
2+
int (*ptrX)[];
3+
4+
int main()
5+
{
6+
ptrX=ptr2;
7+
ptr2=ptrX;
8+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
CORE
2+
main.c
3+
--verbosity 3
4+
^EXIT=0$
5+
^SIGNAL=0$
6+
--
7+
incompatible pointer types
8+
^CONVERSION ERROR$

src/ansi-c/c_typecast.cpp

+7
Original file line numberDiff line numberDiff line change
@@ -543,6 +543,13 @@ void c_typecastt::implicit_typecast_followed(
543543
// Also generous: between any to scalar types it's ok.
544544
// We should probably check the size.
545545
}
546+
else if(src_sub.id()==ID_array &&
547+
dest_sub.id()==ID_array &&
548+
base_type_eq(src_sub.subtype(), dest_sub.subtype(), ns))
549+
{
550+
// we ignore the size of the top-level array
551+
// in the case of pointers to arrays
552+
}
546553
else
547554
warnings.push_back("incompatible pointer types");
548555

0 commit comments

Comments
 (0)