Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions regression/ansi-c/Function_pointer1/conversion.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
int (*ptr2)[2];
int (*ptrX)[];

int main()
{
ptrX=ptr2;
ptr2=ptrX;
}
8 changes: 8 additions & 0 deletions regression/ansi-c/Function_pointer1/test_conversion.desc
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
CORE
conversion.c
--verbosity 3
^EXIT=0$
^SIGNAL=0$
--
incompatible pointer types
^CONVERSION ERROR$
7 changes: 7 additions & 0 deletions src/ansi-c/c_typecast.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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");

Expand Down