[llvm-bugs] [Bug 43038] New: Optimized and unoptimized version of the clang-built program behave differently

via llvm-bugs llvm-bugs at lists.llvm.org
Sun Aug 18 16:46:27 PDT 2019


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

            Bug ID: 43038
           Summary: Optimized and unoptimized version of the clang-built
                    program behave differently
           Product: clang
           Version: 8.0
          Hardware: PC
                OS: FreeBSD
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: C++11
          Assignee: unassignedclangbugs at nondot.org
          Reporter: yuri at tsoft.com
                CC: blitzrakete at gmail.com, dgregor at apple.com,
                    erik.pilkington at gmail.com, llvm-bugs at lists.llvm.org,
                    richard-llvm at metafoo.co.uk

Created attachment 22387
  --> https://bugs.llvm.org/attachment.cgi?id=22387&action=edit
testcase

The attached testcase's behavior is different when it is built with -O2 and
without -O2.

With -O2 it fails with this Eigen exception:
> Assertion failed: (lhs.cols() == rhs.rows() && "invalid matrix product" && "if you wanted a coeff-wise or a dot product use the respective explicit functions"), function Product, file /usr/local/include/eigen3/Eigen/src/Core/Product.h, line 97.
> Abort trap

Without -O2 it doesn't print the exception and succeeds.

The line labeled with "// BUG" seems to be related.
It produces some Eigen-specific type
(N5Eigen7ProductINS_6MatrixIdLin1ELin1ELi0ELin1ELin1EEES2_Li0EEE) in place of
"auto" that later crashes with -O2.
If this "auto" is replaced with "M" (regular matrix) - it doesn't crash with
-O2.

While looking at this code, I can't tell why does it fail conditionally on -O2
like this. Nothing there alters that matrix, or any arguments of that
multiplication.

Optimization level should not trigger changes of behavior like this, especially
additional asserts.


clang-8 and clang-9 on FreeBSD 12 amd64.

-- 
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/20190818/36cebf43/attachment-0001.html>


More information about the llvm-bugs mailing list