<html>
    <head>
      <base href="https://bugs.llvm.org/">
    </head>
    <body><table border="1" cellspacing="0" cellpadding="8">
        <tr>
          <th>Bug ID</th>
          <td><a class="bz_bug_link 
          bz_status_NEW "
   title="NEW - unable to access optimized away parameters, clang Debugging Optimized Code"
   href="https://bugs.llvm.org/show_bug.cgi?id=43289">43289</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>unable to access optimized away parameters, clang Debugging Optimized Code
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>new-bugs
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>unspecified
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>PC
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>Linux
          </td>
        </tr>

        <tr>
          <th>Status</th>
          <td>NEW
          </td>
        </tr>

        <tr>
          <th>Keywords</th>
          <td>new-feature
          </td>
        </tr>

        <tr>
          <th>Severity</th>
          <td>normal
          </td>
        </tr>

        <tr>
          <th>Priority</th>
          <td>P
          </td>
        </tr>

        <tr>
          <th>Component</th>
          <td>new bugs
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td>unassignedbugs@nondot.org
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>sourav0311@gmail.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>htmldeveloper@gmail.com, llvm-bugs@lists.llvm.org
          </td>
        </tr></table>
      <p>
        <div>
        <pre>For CLANG compiled following test case, GDB is not able access and locate
optimized away parameters.
CLANG 10, gdb 8.3 --used

$clang++ -Xclang -femit-debug-entry-values -O2 -ggdb test1.cpp

#include <iostream>
int func(int* ptr){

        std::cout << *ptr;
        return *ptr + 5;
}

int main(int argc, char** argv){

        int a = 4;
        int* ptr_a = &a;

        int b = func(ptr_a);

        return 0;
}

gdb -q a.out -ex "b func" -ex "r" -ex "print ptr"
Reading symbols from a.out...
Breakpoint 1 at 0x2010f4: func. (2 locations)
Starting program: /home/sourabh/work/dwarf/c_c++/c++11/a.out

Breakpoint 1, func (ptr=<optimized out>) at ../doc/test1.cpp:4
4               std::cout << *ptr;
$1 = <optimized out>
(gdb) print *ptr
value has been optimized out</pre>
        </div>
      </p>


      <hr>
      <span>You are receiving this mail because:</span>

      <ul>
          <li>You are on the CC list for the bug.</li>
      </ul>
    </body>
</html>