[Bug tree-optimization/108023] Incorrect line number in ASAN's report

2022-12-08 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108023

Andrew Pinski  changed:

   What|Removed |Added

  Component|sanitizer   |tree-optimization
 Ever confirmed|0   |1
 Status|UNCONFIRMED |NEW
   Last reconfirmed||2022-12-08

--- Comment #1 from Andrew Pinski  ---
LIM loses the line #.
We go from:
   [local count: 955630225]:
  # b.1_46 = PHI <_16(6), [/app/example.cpp:16:17 discrim 1] 0(5)>
  [/app/example.cpp:17:7] # DEBUG BEGIN_STMT
  [/app/example.cpp:17:17] _9 = *j_1;
  [/app/example.cpp:17:19] _11 = (long unsigned int) h_45;
  [/app/example.cpp:17:20] _12 = _11 * 4;
  [/app/example.cpp:17:20] _13 = _9 + _12;
  [/app/example.cpp:17:20] _14 = *_13;
  [/app/example.cpp:17:12] MEM[(int *)k_8 + 12B] = _14;
  [/app/example.cpp:16:5 discrim 3] # DEBUG BEGIN_STMT
  [/app/example.cpp:16:5 discrim 3] _16 = b.1_46 + 1;
  [/app/example.cpp:16:5 discrim 3] b = _16;
  [/app/example.cpp:16:17 discrim 1] # DEBUG BEGIN_STMT
  [/app/example.cpp:16:17 discrim 1] if (_16 <= 2)
goto ; [89.00%]
  else
goto ; [11.00%]

To:
   [local count: 955630225]:
  # b.1_46 = PHI <_16(10), [/app/example.cpp:16:17 discrim 1] 0(5)>
  [/app/example.cpp:17:7] # DEBUG BEGIN_STMT
  [/app/example.cpp:17:12] k__lsm.10_48 = _14;
  [/app/example.cpp:16:5 discrim 3] # DEBUG BEGIN_STMT
  [/app/example.cpp:16:5 discrim 3] _16 = b.1_46 + 1;
  [/app/example.cpp:16:5 discrim 3] b_lsm.11_26 = _16;
  [/app/example.cpp:16:17 discrim 1] # DEBUG BEGIN_STMT
  [/app/example.cpp:16:17 discrim 1] if (_16 <= 2)
goto ; [89.00%]
  else
goto ; [11.00%]

   [local count: 850510901]:
  goto ; [100.00%]

   [local count: 118111600]:
  # b_lsm.11_36 = PHI 
  # k__lsm.10_6 = PHI 
  MEM[(int *)k_8 + 12B] = k__lsm.10_6;
  b = b_lsm.11_36;

Seems like LIM could in theory copy the line # but that might even confuse
people while debugging 

I don't know what the best appoarch here really.
Just use -Og instead?

[Bug tree-optimization/108023] Incorrect line number in ASAN's report

2022-12-11 Thread rguenth at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108023

--- Comment #2 from Richard Biener  ---
LIM store-motion combines possibly multiple store locations into a single one,
and I agree it's possibly confusing to assign the location to the real store in
this way.