Message ID | 20151005135323.GK6184@redhat.com |
---|---|
State | New |
Headers | show |
On Mon, 5 Oct 2015, Marek Polacek wrote: > Here, we were crashing on an assert in duplicate_ssa_name_range_info: > > 506 gcc_assert (!SSA_NAME_ANTI_RANGE_P (name)); > > The problem is that reset_flow_sensitive_info wasn't clearing the > SSA_NAME_ANTI_RANGE_P flag; I don't think NULL SSA_NAME_RANGE_INFO > can ever describe an anti-range... Yeah, also not a range. Thus I think the assert is bogus (aka superfluous) if !SSA_NAME_RANGE_INFO (name) holds. Otherwise other setters of SSA_NAME_RANGE_INFO would need to make sure SSA_NAME_ANTI_RANGE_P is cleared as well. > Bootstrapped/regtested on x86_64-linux, ok for trunk/5? So - can you instead remove the assert? Thanks, Richard. > 2015-10-05 Marek Polacek <polacek@redhat.com> > > PR tree-optimization/67821 > * tree-ssanames.c (reset_flow_sensitive_info): Also clear > the SSA_NAME_ANTI_RANGE_P flag. > > * gcc.dg/torture/pr67821-2.c: New test. > * gcc.dg/torture/pr67821.c: New test. > > diff --git gcc/testsuite/gcc.dg/torture/pr67821-2.c gcc/testsuite/gcc.dg/torture/pr67821-2.c > index e69de29..38cfc84 100644 > --- gcc/testsuite/gcc.dg/torture/pr67821-2.c > +++ gcc/testsuite/gcc.dg/torture/pr67821-2.c > @@ -0,0 +1,14 @@ > +/* { dg-do compile } */ > + > +int a, b, c, d, e, g; > +short f; > + > +void > +fn1 () > +{ > + int i; > + f = a - b; > + e = (c && (i = d = (unsigned) f - 1)) || i; > + g = (unsigned) f - 1; > + c && (d = 0); > +} > diff --git gcc/testsuite/gcc.dg/torture/pr67821.c gcc/testsuite/gcc.dg/torture/pr67821.c > index e69de29..1c9e8b9 100644 > --- gcc/testsuite/gcc.dg/torture/pr67821.c > +++ gcc/testsuite/gcc.dg/torture/pr67821.c > @@ -0,0 +1,15 @@ > +/* { dg-do compile } */ > + > +int isdigit (int); > + > +int > +foo (const char *s) > +{ > + int success = 1; > + const char *p = s + 2; > + if (!isdigit (*p)) > + success = 0; > + while (isdigit (*p)) > + ++p; > + return success; > +} > diff --git gcc/tree-ssanames.c gcc/tree-ssanames.c > index 64e2379..c3484fe 100644 > --- gcc/tree-ssanames.c > +++ gcc/tree-ssanames.c > @@ -561,7 +561,10 @@ reset_flow_sensitive_info (tree name) > mark_ptr_info_alignment_unknown (SSA_NAME_PTR_INFO (name)); > } > else > - SSA_NAME_RANGE_INFO (name) = NULL; > + { > + SSA_NAME_RANGE_INFO (name) = NULL; > + SSA_NAME_ANTI_RANGE_P (name) = 0; > + } > } > > /* Clear all flow sensitive data from all statements and PHI definitions > > Marek > >
diff --git gcc/testsuite/gcc.dg/torture/pr67821-2.c gcc/testsuite/gcc.dg/torture/pr67821-2.c index e69de29..38cfc84 100644 --- gcc/testsuite/gcc.dg/torture/pr67821-2.c +++ gcc/testsuite/gcc.dg/torture/pr67821-2.c @@ -0,0 +1,14 @@ +/* { dg-do compile } */ + +int a, b, c, d, e, g; +short f; + +void +fn1 () +{ + int i; + f = a - b; + e = (c && (i = d = (unsigned) f - 1)) || i; + g = (unsigned) f - 1; + c && (d = 0); +} diff --git gcc/testsuite/gcc.dg/torture/pr67821.c gcc/testsuite/gcc.dg/torture/pr67821.c index e69de29..1c9e8b9 100644 --- gcc/testsuite/gcc.dg/torture/pr67821.c +++ gcc/testsuite/gcc.dg/torture/pr67821.c @@ -0,0 +1,15 @@ +/* { dg-do compile } */ + +int isdigit (int); + +int +foo (const char *s) +{ + int success = 1; + const char *p = s + 2; + if (!isdigit (*p)) + success = 0; + while (isdigit (*p)) + ++p; + return success; +} diff --git gcc/tree-ssanames.c gcc/tree-ssanames.c index 64e2379..c3484fe 100644 --- gcc/tree-ssanames.c +++ gcc/tree-ssanames.c @@ -561,7 +561,10 @@ reset_flow_sensitive_info (tree name) mark_ptr_info_alignment_unknown (SSA_NAME_PTR_INFO (name)); } else - SSA_NAME_RANGE_INFO (name) = NULL; + { + SSA_NAME_RANGE_INFO (name) = NULL; + SSA_NAME_ANTI_RANGE_P (name) = 0; + } } /* Clear all flow sensitive data from all statements and PHI definitions