This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH] Fix miscompilation in output_constant_def
- From: Mark Mitchell <mark at codesourcery dot com>
- To: Maxim Kuvyrkov <maxim at codesourcery dot com>
- Cc: Jeff Law <law at redhat dot com>, meloun at miracle dot cz, gcc-patches <gcc-patches at gcc dot gnu dot org>
- Date: Sun, 05 Jul 2009 12:50:57 -0700
- Subject: Re: [PATCH] Fix miscompilation in output_constant_def
- References: <491DB2C6.7658.C2CA2E3@meloun.miracle.cz> <49207382.5000305@codesourcery.com> <492C4A04.9090100@redhat.com> <4A4105C6.4080006@codesourcery.com> <4A497BDB.8040409@codesourcery.com> <4A50FD42.10100@codesourcery.com>
Maxim Kuvyrkov wrote:
>> However, I'm not sure whether that copying needs to happen in
>> output_constant_def, or could happen somewhere later in the process.
>> What does the call stack look like at the point where the RTX "escapes"
>> from varasm.c?
>
> The backtrace is rather unamusing:
>
> #0 output_constant_def (exp=0xf7dd7e70, defer=1) at varasm.c:3259
> #1 0x0830c8ea in expand_expr_constant (exp=0xf7dd7e70, defer=1,
> modifier=EXPAND_NORMAL) at expr.c:6799
> But you're right, copying should be done sometime later and that place
> is, I believe, unshare rtl pass.
> Therefore, if we set this flag in output_constant_def, the RTX will be
> copied, if still used, in unshare pass. Still, this is basically the
> same as copying the rtx in output_constant_def itself.
I like this idea. That should make copies if and only if actually
necessary, which seems like a good thing. If nobody objects within 72
hours, please go ahead and check this in. If you can put together a
test case to go with the patch, that would be a good thing.
Thanks,
--
Mark Mitchell
CodeSourcery
mark@codesourcery.com
(650) 331-3385 x713