This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |
Other format: | [Raw text] |
Tested on i686-linux. The compiler already had circuitry to detect whether every exit branch of an IF or CASE was terminated by an unconditional transfer of control. If so, the statement after the IF or CASE is dead code, and is diagnosed as unreachable. However, in the case of a block, no such analysis was done. This patch implements exactly parallel handling for blocks. Now, all exit paths from a block are checked (there can be more than one because of exception handlers), and if all are terminated by an unconditional transfer of control, then the statement after the block is unreachable. The treatment of blocks is exactly parallel to the treatment of IF and CASE, so no new mechanism was required, it was just a matter of using this existing mechanism for blocks. branch of an IF or CASE was terminated by an unconditional transfer of control. If so, the statement after the IF or CASE is dead code, and is diagnosed as unreachable. However, in the case of a block, no such analysis was done. This patch implements exactly parallel handling for blocks. Now, all exit paths from a block are checked (there can be more than one because of exception handlers), and if all are terminated by an unconditional transfer of control, then the statement after the block is unreachable. The treatment of blocks is exactly parallel to the treatment of IF and CASE, so no new mechanism was required, it was just a matter of using this existing mechanism for blocks. 2004-10-04 Robert Dewar <dewar@gnat.com> * sem_ch5.adb (Unblocked_Exit_Count): Now used for blocks as well as IF and CASE. (Analyze_Block_Statement): Add circuitry to detect following dead code (Check_Unreachable_Code): Handle case of block exit
Attachment:
difs.19
Description: Text document
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |