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: unassignedclangb...@nondot.org
          Reporter: y...@tsoft.com
                CC: blitzrak...@gmail.com, dgre...@apple.com,
                    erik.pilking...@gmail.com, llvm-bugs@lists.llvm.org,
                    richard-l...@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.
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to