Sometimes, people ask questions about why a certain program won't work with an open-source compiler, and the answer turns out to be that it is probably a bug in the compiler. One such example is here.
If it looks as if the bug isn't yet known, I recommend to file a bug report. If the user doesn't want to do so for himself, I think everybody is best served if somebody else files that report.
So, would it be OK to take code from a Stack Overflow post and put it on, for example, GCC Bugzilla, maintaing a link to the original code in the bug report to maintain attribution? What if the code (possibly modified) ended up in the GCC testsuite?