[llvm-bugs] [Bug 35508] Labels generated, but no code above 'O0'

via llvm-bugs llvm-bugs at lists.llvm.org
Sun Dec 3 05:03:55 PST 2017


https://bugs.llvm.org/show_bug.cgi?id=35508

Dimitry Andric <dimitry at andric.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         Resolution|---                         |INVALID
                 CC|                            |dimitry at andric.com
             Status|NEW                         |RESOLVED

--- Comment #1 from Dimitry Andric <dimitry at andric.com> ---
Since you are assigning a null pointer to b, the operation "int c = *b" is
undefined, and basically everything after that is undefined.  So clang decides
to optimize the whole loop away.

If you really want to dereference the null pointer anyway (which will crash at
runtime), try using "volatile int *" instead.

-- 
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/20171203/c17389e0/attachment.html>


More information about the llvm-bugs mailing list