This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: mark_set_resources does not respect UNSPEC_VOLATILE
- To: mark at codesourcery dot com
- Subject: Re: mark_set_resources does not respect UNSPEC_VOLATILE
- From: Jim Wilson <wilson at cygnus dot com>
- Date: Tue, 04 May 1999 15:01:59 -0700
- cc: egcs-patches at egcs dot cygnus dot com
I've analyzed the problem, and I'm amazed we haven't seen this more
often.
Note the reloading of the `gp' register ($28) about half way through.
The gp register value is always the same, except when we are in shared
libraries. So the bug won't cause any harm unless this is a shared library
function returning to the main program, or this is a function in the main
program which calls into a shared library routine after the gp restore.
These are going to be uncommon situations, so it isn't all that surprising
that it took us a long time to find the problem.
I was a bit surprised the first time I saw this kind of problem, but I've seen
it happen enough times now that it doesn't surprise me much.
* resource.c (mark_set_resources): Handle UNSPEC_VOLATILE and
ASM_INPUT.
This looks pretty reasonable.
You check for ASM_INPUT doesn't work the way you intended. mark_set_resources
recursively processes RTL, and a extended asm with input operations will have
asm_input rtx inside of it, so your check for ASM_INPUT will catch some
extended asms in addition to all traditional asms. This can be fixed by
adding explicit support for ASM_OPERANDS as is already done in
mark_used_resources.
I think you should go ahead and add support for TRAP_IF and ASM_OPERANDS to
mark_set_resources similarly to how they are handled in mark_used_resources.
Jim