This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: GCC Status Report (2004-03-09)
> (1) Try my scheduling barrier idea, where we introduce a volatile asm
> equivalent between the clearing and the normal assignment. I know this
> is potentially pessimizing, but in practice the pessimization will
> probably be slight.
>
> (2) In the unsafe case, implement the C99 rule by explicitly clearing
> each individual field. In other words, iterate through the fields,
> clearing all of the fields that do not have an explicit CONSTRUCTOR_ELT.
>
> I think (1) will probably be less pessimizing that (2). Are you willing
> to give that a try?
The attached patch fixes PR opt/13424 (both on PA and UltraSPARC) and doesn't
do any harm to the testcase on x86. OK for mainline and 3.4 branch after a
complete testing cycle on x86?
2004-03-18 Eric Botcazou <ebotcazou@libertysurf.fr>
Mark Mitchell <mark@codesourcery.com>
PR optimization/13424
* expr.c (store_constructor): Emit a blockage after clearing the
aggregate because of an incomplete or mostly zero constructor.
--
Eric BotcazouIndex: expr.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/expr.c,v
retrieving revision 1.615.4.9
diff -u -p -r1.615.4.9 expr.c
--- expr.c 13 Mar 2004 18:26:23 -0000 1.615.4.9
+++ expr.c 17 Mar 2004 17:56:20 -0000
@@ -4560,6 +4560,18 @@ store_constructor (tree exp, rtx target,
clear_storage (xtarget, GEN_INT (size));
cleared = 1;
+
+ /* ??? Emit a blockage to prevent the scheduler from swapping the
+ memory write issued just above and the memory write that may be
+ issued below to initialize each field. This is needed for a
+ read-write field because the former write may carry the /u
+ flag and not the latter, so they will not conflict. Note that
+ the clearing cannot be simply disabled in the unsafe cases
+ because the C front-end relies on it to implement the semantics
+ of constructors for automatic objects.
+ However, not all machine descriptions define a blockage insn,
+ so emit an ASM_INPUT to act as one. ?*/
+ emit_insn (gen_rtx_ASM_INPUT (VOIDmode, ""));
}
if (! cleared)