https://gcc.gnu.org/bugzilla/show_bug.cgi?id=70922
--- Comment #9 from Jakub Jelinek <jakub at gcc dot gnu.org> --- If you want your macro to be immune from this, can't you do something like: static inline struct obj_section * whatever (struct obj_section *osect, struct obj_section *sections_end) { while (osect < sections_end && osect->the_bfd_section != 0) osect++; return osect; } and define: #define ALL_OBJFILE_OSECTIONS(objfile, osect) \ for (osect = sections; whatever (osect, sections_end) < sections_end; osect++) (or use ({ }) directly in the condition if you rely on GNU extensions)?