public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/106247] New: GCC12 warning in Eigen: array subscript is partly outside array bounds
@ 2022-07-10 16:11 fchelnokov at gmail dot com
  2022-07-10 19:18 ` [Bug tree-optimization/106247] " pinskia at gcc dot gnu.org
                   ` (6 more replies)
  0 siblings, 7 replies; 8+ messages in thread
From: fchelnokov at gmail dot com @ 2022-07-10 16:11 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=106247

            Bug ID: 106247
           Summary: GCC12 warning in Eigen: array subscript is partly
                    outside array bounds
           Product: gcc
           Version: 12.1.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: fchelnokov at gmail dot com
  Target Milestone: ---

If one compiles the following program using Eigen 3.4.0:

#include <Eigen/Dense>

int main(){
    Eigen::Array<double, 2, 2> a;
    a.setRandom();
    Eigen::Array<double, 3, 2> b;
    b.col(0).tail(2) = a.col(1);
}


in GCC12 with command-line options: -std=c++20 -Wall -Wextra -pedantic-errors
-O2 -march=haswell
then a large error occurs ending with

/opt/compiler-explorer/gcc-12.1.0/lib/gcc/x86_64-linux-gnu/12.1.0/include/avxintrin.h:893:24:
warning: array subscript '__m256d_u[0]' is partly outside array bounds of
'Eigen::Array<double, 2, 2> [1]' [-Warray-bounds]
  893 |   return *(__m256d_u *)__P;
      |                        ^~~

Similar errors occur with other -march options or other code using Eigen
library.

Everything is fine in GCC 11 or other compilers. Online demo:
https://gcc.godbolt.org/z/hT348GYo9

Is it Eigen or GCC bug? Related discussion:
https://stackoverflow.com/q/72871100/7325599

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2022-09-04  6:08 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-07-10 16:11 [Bug c++/106247] New: GCC12 warning in Eigen: array subscript is partly outside array bounds fchelnokov at gmail dot com
2022-07-10 19:18 ` [Bug tree-optimization/106247] " pinskia at gcc dot gnu.org
2022-07-10 19:26 ` pinskia at gcc dot gnu.org
2022-07-10 19:34 ` fchelnokov at gmail dot com
2022-07-10 19:37 ` pinskia at gcc dot gnu.org
2022-08-02  4:51 ` skunk at iskunk dot org
2022-09-04  6:06 ` mwd at md5i dot com
2022-09-04  6:08 ` mwd at md5i dot com

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).