[llvm-bugs] [Bug 36750] Meyers' singleton does not work with [[gnu::pure]] and -O1 to -O3

via llvm-bugs llvm-bugs at lists.llvm.org
Mon Mar 19 13:05:07 PDT 2018


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

Eli Friedman <efriedma at codeaurora.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         Resolution|---                         |INVALID
             Status|REOPENED                    |RESOLVED

--- Comment #5 from Eli Friedman <efriedma at codeaurora.org> ---
That's still wrong; the function writes to memory.

The point the gcc developer is making is that *if you can hide the
initialization from the compiler* then the function is "pure" because the
compiler can't prove when the initialization actually happened, so you can
pretend the function never had any side-effects in the first place.  Here, the
compiler can see the initialization, so that reasoning doesn't work.

-- 
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/20180319/c9a62ea9/attachment.html>


More information about the llvm-bugs mailing list