[LLVMbugs] [Bug 19824] New: Invalid code generation / optimization of C++ with -O3
bugzilla-daemon at llvm.org
bugzilla-daemon at llvm.org
Wed May 21 21:30:44 PDT 2014
http://llvm.org/bugs/show_bug.cgi?id=19824
Bug ID: 19824
Summary: Invalid code generation / optimization of C++ with -O3
Product: clang
Version: trunk
Hardware: PC
OS: MacOS X
Status: NEW
Severity: normal
Priority: P
Component: LLVM Codegen
Assignee: unassignedclangbugs at nondot.org
Reporter: dane at mapbox.com
CC: llvmbugs at cs.uiuc.edu
Classification: Unclassified
After upgrading to Xcode 5.1.1 / Apple LLVM version 5.1 (clang-503.0.40) (based
on LLVM 3.4svn) I'm seeing a case where clang++ seems to mis-generate code when
the -O3 flag is used. The symptom is failing testcases in my application that
have been passing for years. Certainly there may be a bug in my code, but here
are the reasons I think clang is at fault:
- if I compile with -Os the problem goes away (only happens with -O3)
- if I put a statement like `std::clog << "foo\n";` in the problem area then
clang seems to generate the correct code. This seems to indicate to me that
clang is over-eagerly optimizing away code and effectively leading to it not
being run.
- the problem did not exist with older clang
The application in question is Mapnik and the problem code involves c++11
lambda functions. I can reproduce the problem with latest clang on OS X and
Ubuntu precise by using the llvm 3.4 packages from http://llvm.org/apt/.
In particular it is this block of code that is (seemingly) disappearing and
never executed at runtime:
https://github.com/mapnik/mapnik/blob/master/src/grid/process_markers_symbolizer.cpp#L123-L132.
If I put `std::clog << "something\n";` inside that `vector_dispatch_type` class
right here
(https://github.com/mapnik/mapnik/blob/master/include/mapnik/grid/grid_marker_helpers.hpp#L225-L228)
then the code does run at runtime and works properly. This seems to indicate to
me that over-eager optimization is at fault - could it be?
I've read http://llvm.org/docs/HowToSubmitABug.html#incorrect-code-generation
but its not clear to me how to use bugpoint for further providing a testcase
since I'm new to reporting bugs against clang. I can provide the output of
-save-temps or -emit-llvm easily, just let me know if these would help.
--
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/20140522/bcb23ef2/attachment.html>
More information about the llvm-bugs
mailing list