Why can’t dead code detection be fully solved by a compiler?

The compilers I’ve been using in C or Java have dead code prevention (warning when a line won’t ever be executed). My professor says that this problem can never be fully solved by compilers though. I was wondering why that is. I am not too familiar with the actual coding of compilers as this is a theory-based class. But I was wondering what they check (such as possible input strings vs acceptable inputs, etc.), and why that is insufficient.

13 Answers
13

Leave a Comment