http://gcc.gnu.org/bugzilla/show_bug.cgi?id=60606
Richard Earnshaw <rearnsha at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|UNCONFIRMED |RESOLVED Resolution|--- |WONTFIX --- Comment #3 from Richard Earnshaw <rearnsha at gcc dot gnu.org> --- > register unsigned long pc asm("pc"); I think it's a mistake to permit this sort of construct. What does: a = pc; b = a+pc; generate for b? Is it exactly twice a (the compiler doesn't see pc changing, so is free to assume that it doesn't), just more than twice a (how much more?) or just less than twice a (different scheduling)? What happens if the user writes pc = 3; // ??? The point is that while it might be valid to use pc in assembly instructions, the constructs you get in high-level languages are essentially meaningless. As has been pointed out, in the few cases where you really need to extract the program counter you can write an inline assembly statement that explicitly references the PC.