Some day, probably, real AI will come and will be able to change the own code if it will have access to it, but even in that case I am not sure about bugs.
It depends on what kind of bugs, many IDEs already are helping you with basic syntax errors and other problems, there is even a startup using ML and StackOverflow to fix common problems on the fly. However, logical and real problems can't be solved looking only on the code, it requires a wider look on the knowledge outside of that scope, what goal and requirements that software should pursuit. Basically solving a bug is usually simple and fast task, while finding answer to the questions like "Is it working as expected?", "Is it what we need?", "Why it's not working, where is a problem?" is not simple.
If that software:
then yes, software can find and fix some of it's parts (but never all, especially on core level) itself, however, the main problem with AI today is "can reason".