This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH] Fix segfault with -fdump-tree-all-all
- From: "Richard Guenther" <richard dot guenther at gmail dot com>
- To: "GCC Patches" <gcc-patches at gcc dot gnu dot org>
- Date: Wed, 19 Mar 2008 16:44:52 +0100
- Subject: Re: [PATCH] Fix segfault with -fdump-tree-all-all
- References: <20080319152931.GD18679@virgil.suse.cz>
On Wed, Mar 19, 2008 at 4:29 PM, Martin Jambor <mjambor@suse.cz> wrote:
> Hi,
>
> I made myself a simple c++ test case (preprocessed source attached)
> and found out that the trunk gcc was segfaulting at it when run with
> -fdump-tree-all-all. The segfault can be fixed by the following patch
> which I have not regression tested nor bootstrapped. I hope it is so
> simple that someone will test and commit it alongside something else.
> Finally, the author of the modified code might want to handle the
> problem differently....
>
> Thanks for attention,
I also hit the case of NULL ddr somewhen, so checking for that as well
would be nice.
Richard.
> Martin
>
> Changelog:
>
> 2008-03-19 Martin Jambor <mjambor@suse.cz>
>
> * tree-data-ref.c (dump_data_dependence_relation): Avoid data
> reference dumps if dependence is unknown.
>
> Patch:
>
> Index: gcc/tree-data-ref.c
> ===================================================================
> --- gcc/tree-data-ref.c (revision 133342)
> +++ gcc/tree-data-ref.c (working copy)
> @@ -362,13 +362,16 @@ dump_data_dependence_relation (FILE *out
> drb = DDR_B (ddr);
> fprintf (outf, "(Data Dep: \n");
>
> + if (DDR_ARE_DEPENDENT (ddr) == chrec_dont_know)
> + {
> + fprintf (outf, " (don't know)\n)\n");
> + return;
> + }
> +
> dump_data_reference (outf, dra);
> dump_data_reference (outf, drb);
>
> - if (DDR_ARE_DEPENDENT (ddr) == chrec_dont_know)
> - fprintf (outf, " (don't know)\n");
> -
> - else if (DDR_ARE_DEPENDENT (ddr) == chrec_known)
> + if (DDR_ARE_DEPENDENT (ddr) == chrec_known)
> fprintf (outf, " (no dependence)\n");
>
> else if (DDR_ARE_DEPENDENT (ddr) == NULL_TREE)
>
>