https://gcc.gnu.org/bugzilla/show_bug.cgi?id=123227
--- Comment #7 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
(In reply to Andrew Pinski from comment #6)
> There is code which does the comparison but some reason it is not rejecting
> this:
> ```
> /* Checking function attributes.
> This is quadratic in number of attributes */
> if (comp_type_attributes (TREE_TYPE (decl),
> TREE_TYPE (item->decl)) != 1)
> return return_false_with_msg ("different type attributes");
> if (!attribute_list_equal (DECL_ATTRIBUTES (decl),
> DECL_ATTRIBUTES (item->decl)))
> return return_false_with_msg ("different decl attributes");
> ```
nonnull is on the decl's type rather than the decl.
Looks like the following ones need to be checked specially as they set
affects_type_identity to be false but they could have an effect on the code:
nonnull
nonnull_if_nonzero
warn_unused_result (need to check)
sentinel (?)
"fn spec" (?)
returns_nonnull (need to check)
alloc_align (need to check)
assume_aligned (need to check)
access (need to check)
fd_arg (need to check)
fd_arg_read (need to check)
fd_arg_write (need to check)
null_terminated_string_arg (need to check)