[Bug c++/67693] Spurious warning: control reaches end of non-void function [-Wreturn-type]

miyuki at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Wed Sep 23 18:24:00 GMT 2015


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

--- Comment #2 from Mikhail Maltsev <miyuki at gcc dot gnu.org> ---
Though... maybe it's not an exact duplicate, but the problem looks seems very
similar. We generate (003t.original):

    struct foo x;
  try
    {
      switch (n)
        {
          case 0:;
          if (n == 4)
            {
              return <retval> = 1;
            }
          else
            {
              return <retval> = 2;
            }
          goto <D.2286>;
          default:;
          return <retval> = 0;
        }
      <D.2286>:;
    }
  finally
    {
      foo::~foo (&x);
    }

And GIMPLE looks like this:

int f(int, int) (int n, int m)
{
  int D.2290;
  struct foo x;

  try
    {
      try
        {
          switch (n) <default: <D.2285>, case 0: <D.2284>>
          <D.2284>:
          if (n == 4) goto <D.2288>; else goto <D.2289>;
          <D.2288>:
          D.2290 = 1;
          return D.2290;
          <D.2289>:
          D.2290 = 2;
          return D.2290;
          goto <D.2286>;
          <D.2285>:
          D.2290 = 0;
          return D.2290;
          <D.2286>:
        }
      finally
        {
          foo::~foo (&x);
        }
    }
  finally
    {
      x = {CLOBBER};
    }
}



More information about the Gcc-bugs mailing list