This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: Bug in handling of CLOBBERS for cse_skip_blocks.
- To: Kamil Iskra <kamil at dwd dot interkom dot pl>
- Subject: Re: Bug in handling of CLOBBERS for cse_skip_blocks.
- From: Jeffrey A Law <law at cygnus dot com>
- Date: Thu, 31 Dec 1998 00:37:44 -0700
- cc: egcs-bugs at cygnus dot com, Gunther Nikl <gnikl at informatik dot uni-rostock dot de>, egcs-patches at cygnus dot com
- Reply-To: law at cygnus dot com
In message <Pine.LNX.3.96.980915151112.767A-100000@jinks.home>you write:
>
> There is a bug in handling of CLOBBERS when using -fcse-skip-blocks
> (enabled by default in -O2). The bug can be reproduced under egcs 1.0.3a,
> as well as 1.1b.
>
> Here's a vastly simplified source, m68k-specific:
>
>
> void*
> f(void)
> {
> void *cl;
>
> cl=(
> {
> register void* ret __asm__("d1");
> __asm__("/* d1 is set here */" : "=r"(ret));
> ret;
> }
> );
> if (cl)
> __asm__("/* d0 and d1 are invalidated here */" : : : "d0", "d1");
>
> return cl;
> }
[ ... ]
I've installed this patch to fix your bug:
* cse.c (invalidate_skipped_block): Call invalidate_from_clobbers
for each insn in the skipped block.
Index: cse.c
===================================================================
RCS file: /egcs/carton/cvsfiles/egcs/gcc/cse.c,v
retrieving revision 1.56
retrieving revision 1.57
diff -c -r1.56 -r1.57
*** cse.c 1998/12/29 11:36:16 1.56
--- cse.c 1998/12/30 23:35:49 1.57
***************
*** 8141,8146 ****
--- 8141,8147 ----
invalidate_for_call ();
}
+ invalidate_from_clobbers (PATTERN (insn));
note_stores (PATTERN (insn), invalidate_skipped_set);
}
}