> On Oct 27, 2024, at 05:02, Martin Uecker <uec...@tugraz.at> wrote: > >> > > For standard attributes, there is a policy that the attribute should > be ignorable, i.e. removing it from a valid program should not cause > any change in semantics. > > For GCC's attributes this is not necessarily the case, but I still > think it is a good policy in general. The reason is that as a reviewer > of code you do not need to take subtle effects of attribute into > account. You can just pretend those do not exist when analyzing > core semantics, which reduces cognitive load and specific knowledge > one has to have to understand what is going on. > > I do not think it is a big issue, but I think it would be better to > if removing / ignoring the attribute would *not* cause a change in > program semantics.
Does the “program semantics” include the behavior of -Warray-bounds, bounds sanitizer, and __builtin_dynamic_object_size()? Qing > > Martin > >> >> Qing >>> >>> So maybe instead of changing the return value of comptypes, >>> we simply set different_types_p (which would prevent >>> redeclaration in the same scope) and also set another flag >>> similar to enum_and_int_p (e.g. inconsistent_counted_by_p) >>> and emit an error in the callers at some appropriate places. >>> >>>>> >>>>> But maybe this is not a problem. >>>> This does look like an issue to me… >>>> Not sure how to resolve such issue at this moment. >>>> >>>> Or, only when the “counted_by” information is included into the TYPE, such >>>> issue can be resolved? >>>