I was experimenting with the way gcc does register allocation depending on different flags. I encountered one strange test file where adding a second asm statement made a first one fail which did work before. Even stranger, when I have both parts as separate functions before, the combined version compiles as well. This interdependence between asm statements seems extremely counterintuitive to me, and might cause difficult to find bugs in larger projects.
The fact that omitting optimization causes my code to fail even for the version including the single asm statements makes this bug seem related to bug 11203. But the behaviour that some code does not compile even with optimizations, and that adding some functions makes those parts compile as well, are strange things not mentioned in that bug, so don't be hasty about marking this a duplicate. My compiler is a Gentoo build. I know you would love to make me reproduce this with a plain vanilla compiler, but I beg you to simply compile my attached test case with your version. If you can't reproduce the bug, I'll happily take this to the gentoo bugzilla. But I expect the cause rather deep inside the sources, nothing likely to be changed by some distribution patch set. -- Summary: Interaction between different asm statements Product: gcc Version: 4.1.1 Status: UNCONFIRMED Severity: normal Priority: P3 Component: inline-asm AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: Martin dot vGagern at gmx dot net GCC build triplet: i686-pc-linux-gnu-gcc GCC host triplet: i686-pc-linux-gnu-gcc GCC target triplet: i686-pc-linux-gnu-gcc http://gcc.gnu.org/bugzilla/show_bug.cgi?id=28635