[llvm-bugs] [Bug 24972] New: Error when working with pointers
via llvm-bugs
llvm-bugs at lists.llvm.org
Mon Sep 28 07:03:09 PDT 2015
https://llvm.org/bugs/show_bug.cgi?id=24972
Bug ID: 24972
Summary: Error when working with pointers
Product: clang
Version: 3.6
Hardware: PC
OS: Linux
Status: NEW
Severity: normal
Priority: P
Component: Driver
Assignee: unassignedclangbugs at nondot.org
Reporter: dvshapkin at mail.ru
CC: llvm-bugs at lists.llvm.org
Classification: Unclassified
Ubuntu clang version: 3.6.0-2ubuntu1
strange error in a simple example...
int main(void)
{
const int num = 1;
int *p = # //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
--
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20150928/3c801670/attachment.html>
More information about the llvm-bugs
mailing list