Fix type compatibility for types with flexible array member 2/2 [PR113688,PR114713,PR117724]
For checking or computing TYPE_CANONICAL, ignore the array size when it is
the last element of a structure or union. To not get errors because of
an inconsistent number of members, zero-sized arrays which are the last
element are not ignored anymore when checking the fields of a struct.
PR c/113688
PR c/114014
PR c/114713
PR c/117724
gcc/ChangeLog:
* tree.cc (gimple_canonical_types_compatible_p): Add exception.
gcc/lto/ChangeLog:
* lto-common.cc (hash_canonical_type): Add exception.
gcc/testsuite/ChangeLog:
* gcc.dg/pr113688.c: New test.
* gcc.dg/pr114014.c: New test.
* gcc.dg/pr114713.c: New test.
* gcc.dg/pr117724.c: New test.
(cherry picked from commit
d46c7f313b5a30ee04080f249e31e12987d50aa2)