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

--- Comment #1 from Martin Sebor <msebor at gcc dot gnu.org> ---
The output of the -fdump-tree-all-lineno option shows the correct location
information in the a.c.007t.omplower dump:

;; Function f (f, funcdef_no=0, decl_uid=1909, cgraph_uid=1, symbol_order=0)

f (int i, int j)
[../a.c:4:1] {
  int * iftmp.0;
  int * D.1920;
  int c;
  int * p;

  try
    {
      [../a.c:6:22] if (i < 0) goto <D.1915>; else goto <D.1916>;
      <D.1915>:
      [../a.c:6:22] iftmp.0 = [../a.c:6:20] &a;
      goto <D.1917>;
      <D.1916>:
      [../a.c:6:22] iftmp.0 = [../a.c:6:24] &b;
      <D.1917>:
      [../a.c:6:8] p = iftmp.0;
      [../a.c:7:7] _1 = [../a.c:7:7] *p;
      [../a.c:7:6] if (_1 != 0) goto <D.1918>; else goto <D.1919>;
      <D.1918>:
      [../a.c:8:12] D.1920 = p;
      [../a.c:8:12] // predicted unlikely by early return (on trees) predictor.
      [../a.c:8:12] return D.1920;
      <D.1919>:
      [../a.c:9:6] if (j < 0) goto <D.1921>; else goto <D.1922>;
      <D.1921>:
      [../a.c:10:7] p = [../a.c:10:9] &c;
      <D.1922>:
      [../a.c:12:10] D.1920 = p;
      [../a.c:12:10] return D.1920;
    }
  finally
    {
      c = {CLOBBER};
    }
}

but the a.c.008t.lower dump below does not.  The two return statements (one on
line 8 and the other on line 12) are merged into one at the end of the
function.  I'm not sure what would be a good solution here.  Keeping the
location of either one of the statement would still lead to inaccurate results
in some cases.  But maybe that's better than no location at all.

;; Function f (f, funcdef_no=0, decl_uid=1909, cgraph_uid=1, symbol_order=0)

f (int i, int j)
{
  int * p;
  int c;
  int * D.1920;
  int * iftmp.0;

  try
    {
      [../a.c:6:22] if (i < 0) goto <D.1915>; else goto <D.1916>;
      <D.1915>:
      [../a.c:6:22] iftmp.0 = [../a.c:6:20] &a;
      goto <D.1917>;
      <D.1916>:
      [../a.c:6:22] iftmp.0 = [../a.c:6:24] &b;
      <D.1917>:
      [../a.c:6:8] p = iftmp.0;
      [../a.c:7:7] _1 = [../a.c:7:7] *p;
      [../a.c:7:6] if (_1 != 0) goto <D.1918>; else goto <D.1919>;
      <D.1918>:
      [../a.c:8:12] D.1920 = p;
      [../a.c:8:12] // predicted unlikely by early return (on trees) predictor.
      [../a.c:8:12] goto <D.1923>;
      <D.1919>:
      [../a.c:9:6] if (j < 0) goto <D.1921>; else goto <D.1922>;
      <D.1921>:
      [../a.c:10:7] p = [../a.c:10:9] &c;
      <D.1922>:
      [../a.c:12:10] D.1920 = p;
      [../a.c:12:10] goto <D.1923>;
    }
  finally
    {
      c = {CLOBBER};
    }
  <D.1923>:
  return D.1920;
}

Reply via email to