This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Should dead stores which could trap be deleted?
- To: gcc at gcc dot gnu dot org
- Subject: Should dead stores which could trap be deleted?
- From: John Wehle <john at feith dot com>
- Date: Fri, 6 Aug 1999 18:40:31 -0400 (EDT)
Consider:
long
subr(long a, long b)
{
long c;
c = a / b;
return 0;
}
currently gcc produces;
pushl %ebp
movl %esp,%ebp
xorl %eax,%eax
leave
ret
when compiled -O2 on x86 due to dead_trivially_dead_insns. Consider
the situation where b equals 0 which on the x86 normally causes a
divide by zero exception. What are the guidelines regarding instructions
which could trap / to what extent is it valid for optimizations to modify
the behaviour of a program with respect to traps?
-- John
-------------------------------------------------------------------------
| Feith Systems | Voice: 1-215-646-8000 | Email: john@feith.com |
| John Wehle | Fax: 1-215-540-5495 | |
-------------------------------------------------------------------------