[llvm-bugs] [Bug 39146] New: clang-cl ignores #pragma optimize("", off), continues optimizing

via llvm-bugs llvm-bugs at lists.llvm.org
Mon Oct 1 15:03:07 PDT 2018


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

            Bug ID: 39146
           Summary: clang-cl ignores #pragma optimize("", off), continues
                    optimizing
           Product: clang
           Version: trunk
          Hardware: PC
                OS: Windows NT
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: C++
          Assignee: unassignedclangbugs at nondot.org
          Reporter: brucedawson at chromium.org
                CC: dgregor at apple.com, llvm-bugs at lists.llvm.org

A handy technique when working on optimized builds is to disable optimizations
for a single source file or function by adding this to the source:

#pragma optimize("", off)

With clang-cl this seems to be silently ignored - functions are still inlined
and become undebuggable. The desired effect can be obtained with this:

#pragma clang optimize off

However, if clang-cl is trying to maintain the semantics of cl.exe then it
needs to support #pragma optimize - and __pragma(optimize... - to avoid the
need for source-code changes.

Chrome's repo has about 35 instances of #pragma optimize("", off), and a couple
of instances of #pragma optimize("g", off). Some of these are bogus and should
be removed, but the compiler should still support the construct, or warn if it
is being ignored (maybe warn on unsupported variants).

-- 
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/20181001/1b29444c/attachment.html>


More information about the llvm-bugs mailing list