This is the mail archive of the gcc@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]

Should dead stores which could trap be deleted?


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  |                         |
-------------------------------------------------------------------------


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]