https://gcc.gnu.org/bugzilla/show_bug.cgi?id=59850
--- Comment #29 from Manuel López-Ibáñez <manu at gcc dot gnu.org> --- (In reply to Tom Tromey from comment #26) > > 2. __force itself presents a problem as its semantics isn't well defined and > > only sparse knows how to model it. in gcc it cannot be an attribute as > > attributes apply to the outermost variable/etc, e.g., you can't use them on > > a pointee in a pointer context. > > Could you elaborate on this? > I think I looked at all the sparse test cases here and I don't recall > encountering any real issues (for address space I had to have a hack to > deal with function return types, but this didn't seem to affect force). > If you have extra tests not in sparse, that would be super. If _Pragma can appear in the same places as __force, I think that would be a superior approach. The trivial approach of using _Pragma("GCC diagnostic ignore") does not seem to work in the middle of expressions, but that may be a defect of the current implementation (PR60875 and PR52116). Otherwise, a (type-generic?) __builtin_force_cast() perhaps would be even better. It seems strange and convoluted to use an attribute for this.