[Bug c++/68449] [5/6 Regression] ICE in cxx_eval_constant_expression on atomic_load in C++

jakub at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Tue Dec 1 11:50:00 GMT 2015


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=68449

--- Comment #3 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Slightly improved testcase:
// PR c++/68449
// { dg-do compile }
// { dg-options "-Wsign-compare" }

int
foo (int a)
{
  return __extension__ ({ int b; b; }) < 0;
}

It seems that if the ctx->values hash table has a record for certain variable,
but it is uninitialized, it has NULL_TREE in there.
Some spots that call ctx->values->get do check for NULL, but others don't.
This particular case is:
3195          if (VAR_P (r))
3196            if (tree *p = ctx->values->get (r))
3197              r = *p;
I wonder if for !*p we just shouldn't keep r the VAR_DECL as is and let the few
lines before complain if needed.  So that would be
  if (VAR_P (r))
    if (tree *p = ctx->values->get (r))
      if (*p)
        r = *p;
or so.


More information about the Gcc-bugs mailing list