This wasn't gym, it was karate, but yes, I've competed with injuries.
I broke my foot a few days before the world competitions, and gimped my way to the ring on crutches, took off the brace, handed the crutches to my coach, and finished the competition not even thinking about the injury (adrenaline is a great painkiller, isn't it?). Afterwards, I was definitely hitting the painkillers, though, and competing on an injury like that isn't something I'd have done for a regular tournament, but this was worlds and I'd been training for it forever, and was not going to let a little thing like a fractured metatarsal stop me. I was hurting for days afterwards, though, but it was so worth it!