https://gcc.gnu.org/bugzilla/show_bug.cgi?id=59448
--- Comment #20 from torvald at gcc dot gnu.org --- (In reply to jos...@codesourcery.com from comment #19) > * carries_dependency is about increasing optimization, not decreasing it. > If it affects when barriers are added, it does so by allowing some > barriers to be omitted that would otherwise be required. That's not quite true, unfortunately, AFAIU. I agree that generally, attributes are supposed to be "ignorable" -- but in the case of carries_dependency, C++11 explicitly requires that all declarations of a function either have the attribute or none has (see 7.6.4p2). This is because you need that to actually exploit the attribute; it's a contract between callers and callees. If a compiler does try to preserve dependencies (or not across function boundaries), then ignoring the attribute is fine. But if there should be a compiler out there that doesn't, and GCC-generated code is supposed to link to that other compiler's code, then we need to do something to make this work.