Public bug reported: OS: Ubuntu 12.04.3 LTS clang version: 3.0-6ubuntu3
In the attached code the function foo2 has a side effect on its second argument. So, despite the fact that value of v1 has been previously set to 0, foo1 sould return 0. But if this code was compiled with -O2 (or higher optimization level) foo1 returns 1. Decompilation shows that after optimization the call of foo2 is placed after the check (v1!=0). ** Affects: clang (Ubuntu) Importance: Undecided Status: New ** Tags: optimizer ** Attachment added: "Example code" https://bugs.launchpad.net/bugs/1251169/+attachment/3908688/+files/clang_bug.c -- You received this bug notification because you are a member of Ubuntu Bugs, which is subscribed to Ubuntu. https://bugs.launchpad.net/bugs/1251169 Title: during compilation with -O2 a function call is moved to the wrong place To manage notifications about this bug go to: https://bugs.launchpad.net/ubuntu/+source/clang/+bug/1251169/+subscriptions -- ubuntu-bugs mailing list ubuntu-bugs@lists.ubuntu.com https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs