* [PATCH] Fix segfault with -fdump-tree-all-all
@ 2008-03-19 15:45 Martin Jambor
2008-03-19 19:46 ` Richard Guenther
0 siblings, 1 reply; 5+ messages in thread
From: Martin Jambor @ 2008-03-19 15:45 UTC (permalink / raw)
To: GCC Patches
[-- Attachment #1: Type: text/plain, Size: 1463 bytes --]
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,
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)
[-- Attachment #2: member.ii.gz --]
[-- Type: application/x-gzip, Size: 4571 bytes --]
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] Fix segfault with -fdump-tree-all-all
2008-03-19 15:45 [PATCH] Fix segfault with -fdump-tree-all-all Martin Jambor
@ 2008-03-19 19:46 ` Richard Guenther
2008-03-19 20:54 ` Martin Jambor
0 siblings, 1 reply; 5+ messages in thread
From: Richard Guenther @ 2008-03-19 19:46 UTC (permalink / raw)
To: GCC Patches
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)
>
>
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] Fix segfault with -fdump-tree-all-all
2008-03-19 19:46 ` Richard Guenther
@ 2008-03-19 20:54 ` Martin Jambor
2008-03-21 13:06 ` Martin Jambor
0 siblings, 1 reply; 5+ messages in thread
From: Martin Jambor @ 2008-03-19 20:54 UTC (permalink / raw)
To: Richard Guenther; +Cc: GCC Patches
On Wed, Mar 19, 2008 at 04:44:52PM +0100, Richard Guenther wrote:
> 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.
OK, the following is equally untested (though compiles and does not
segfault) but not much more complex.
Changelog:
2008-03-19 Martin Jambor <mjambor@suse.cz>
* tree-data-ref.c (dump_data_dependence_relation): Avoid data
reference dumps if ddr is NULL or dependence is unknown.
Patch:
Index: gcc/tree-data-ref.c
===================================================================
--- gcc/tree-data-ref.c (revision 133342)
+++ gcc/tree-data-ref.c (working copy)
@@ -358,17 +358,20 @@ dump_data_dependence_relation (FILE *out
{
struct data_reference *dra, *drb;
- dra = DDR_A (ddr);
- drb = DDR_B (ddr);
fprintf (outf, "(Data Dep: \n");
+ if (!ddr || DDR_ARE_DEPENDENT (ddr) == chrec_dont_know)
+ {
+ fprintf (outf, " (don't know)\n)\n");
+ return;
+ }
+
+ dra = DDR_A (ddr);
+ drb = DDR_B (ddr);
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)
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] Fix segfault with -fdump-tree-all-all
2008-03-19 20:54 ` Martin Jambor
@ 2008-03-21 13:06 ` Martin Jambor
2008-03-21 13:11 ` Richard Guenther
0 siblings, 1 reply; 5+ messages in thread
From: Martin Jambor @ 2008-03-21 13:06 UTC (permalink / raw)
To: GCC Patches
The patch below passed bootstrap and testsuite with no new regressions
on linux-i386. I did not bootstrap ADA though (so that the test
finished overnight) but I hope that does not matter with such a small
change in debug dumping code.
OK, to commit?
Thanks,
Martin
On Wed, Mar 19, 2008 at 07:18:11PM +0100, Martin Jambor wrote:
> Changelog:
>
> 2008-03-19 Martin Jambor <mjambor@suse.cz>
>
> * tree-data-ref.c (dump_data_dependence_relation): Avoid data
> reference dumps if ddr is NULL or dependence is unknown.
>
> Patch:
>
> Index: gcc/tree-data-ref.c
> ===================================================================
> --- gcc/tree-data-ref.c (revision 133342)
> +++ gcc/tree-data-ref.c (working copy)
> @@ -358,17 +358,20 @@ dump_data_dependence_relation (FILE *out
> {
> struct data_reference *dra, *drb;
>
> - dra = DDR_A (ddr);
> - drb = DDR_B (ddr);
> fprintf (outf, "(Data Dep: \n");
>
> + if (!ddr || DDR_ARE_DEPENDENT (ddr) == chrec_dont_know)
> + {
> + fprintf (outf, " (don't know)\n)\n");
> + return;
> + }
> +
> + dra = DDR_A (ddr);
> + drb = DDR_B (ddr);
> 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)
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] Fix segfault with -fdump-tree-all-all
2008-03-21 13:06 ` Martin Jambor
@ 2008-03-21 13:11 ` Richard Guenther
0 siblings, 0 replies; 5+ messages in thread
From: Richard Guenther @ 2008-03-21 13:11 UTC (permalink / raw)
To: GCC Patches
On Fri, Mar 21, 2008 at 12:45 PM, Martin Jambor <mjambor@suse.cz> wrote:
> The patch below passed bootstrap and testsuite with no new regressions
> on linux-i386. I did not bootstrap ADA though (so that the test
> finished overnight) but I hope that does not matter with such a small
> change in debug dumping code.
>
> OK, to commit?
Ok. (Indeed Ada is not a language that is requried for testing, only default
languages are)
Thanks,
Richard.
> Thanks,
>
> Martin
>
>
>
> On Wed, Mar 19, 2008 at 07:18:11PM +0100, Martin Jambor wrote:
> > Changelog:
> >
> > 2008-03-19 Martin Jambor <mjambor@suse.cz>
> >
> > * tree-data-ref.c (dump_data_dependence_relation): Avoid data
> > reference dumps if ddr is NULL or dependence is unknown.
> >
> > Patch:
> >
> > Index: gcc/tree-data-ref.c
> > ===================================================================
> > --- gcc/tree-data-ref.c (revision 133342)
> > +++ gcc/tree-data-ref.c (working copy)
> > @@ -358,17 +358,20 @@ dump_data_dependence_relation (FILE *out
> > {
> > struct data_reference *dra, *drb;
> >
> > - dra = DDR_A (ddr);
> > - drb = DDR_B (ddr);
> > fprintf (outf, "(Data Dep: \n");
> >
> > + if (!ddr || DDR_ARE_DEPENDENT (ddr) == chrec_dont_know)
> > + {
> > + fprintf (outf, " (don't know)\n)\n");
> > + return;
> > + }
> > +
> > + dra = DDR_A (ddr);
> > + drb = DDR_B (ddr);
> > 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)
>
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2008-03-21 12:00 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-03-19 15:45 [PATCH] Fix segfault with -fdump-tree-all-all Martin Jambor
2008-03-19 19:46 ` Richard Guenther
2008-03-19 20:54 ` Martin Jambor
2008-03-21 13:06 ` Martin Jambor
2008-03-21 13:11 ` Richard Guenther
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).