https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80779
--- Comment #2 from Alexander Ivchenko <aivchenk at gcc dot gnu.org> --- I made some progress a while back with that, mostly by adding __attribute__((bnd_legacy)) just as in Martin's patches. I don't like that approach though, as it does not look natural. The two thinks that I found are: 1) There are cases where we have union at the end of the struct, where one field of the union is a flexible array. I marked those fields of the struct with corresponding attribute, but, probably, more natural would be to add that by default when "-fchkp-flexible-struct-trailing-arrays" option is used. We have a lot of false positives because of that 2) I found a real bounds violation :) In ipa-chkp.c in chkp_map_attr_arg_indexes there is a "idx = indexes[idx - 1] + 1;" in the loop. Here, "idx" may be zero