<html>
    <head>
      <base href="https://llvm.org/bugs/" />
    </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 --- - Error when working with pointers"
   href="https://llvm.org/bugs/show_bug.cgi?id=24972">24972</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>Error when working with pointers
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>clang
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>3.6
          </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>Severity</th>
          <td>normal
          </td>
        </tr>

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

        <tr>
          <th>Component</th>
          <td>Driver
          </td>
        </tr>

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

        <tr>
          <th>Reporter</th>
          <td>dvshapkin@mail.ru
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvm-bugs@lists.llvm.org
          </td>
        </tr>

        <tr>
          <th>Classification</th>
          <td>Unclassified
          </td>
        </tr></table>
      <p>
        <div>
        <pre>Ubuntu clang version: 3.6.0-2ubuntu1

strange error in a simple example...

int main(void)
{
    const int num = 1;
    int *p = &num;       //warning - ok

    printf("num = %d,  &num = %p\n", num, &num);   // num == 1, ok
    printf("*p  = %d,  p    = %p\n",  *p, p);      // *p == 1, ok

    *p = 2;

    printf("num = %d,  &num = %p\n", num, &num);   // num == 2, but see output
    printf("*p  = %d,  p    = %p\n",  *p, p);      // *p == 2, ok

    return 0;
}

<b>Output:</b>

num = 1,  &num = 0x7ffe479d91e8
*p  = 1,  p    = 0x7ffe479d91e8
num = 1,  &num = 0x7ffe479d91e8   <--- why num == 1 ???   must be num == 2
*p  = 2,  p    = 0x7ffe479d91e8</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>