public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "skunk at iskunk dot org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug tree-optimization/106247] GCC12 warning in Eigen: array subscript is partly outside array bounds
Date: Tue, 02 Aug 2022 04:51:29 +0000	[thread overview]
Message-ID: <bug-106247-4-dhSRLYL9Jx@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-106247-4@http.gcc.gnu.org/bugzilla/>

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

Daniel Richard G. <skunk at iskunk dot org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |skunk at iskunk dot org

--- Comment #4 from Daniel Richard G. <skunk at iskunk dot org> ---
I am seeing what may be the same issue in a different context.

This is occurring in a proprietary C source codebase newly being compiled with
12.1.0, and unfortunately the problem goes away if I attempt to cut it down to
a minimal test case. Nevertheless, the actual issue is quite simple, and IMO
clear-cut.

(some names edited to protect the guilty)

In file included from /usr/include/string.h:375,
                 from foo.c:7:
In function 'function3',
    inlined from 'function2' at foo.c:1206:5,
    inlined from 'function1' at foo.c:2840:7:
foo.c:415:3: error: array subscript 'union <anonymous>[1]' is partly outside
array bounds of 'unsigned char[5]' [-Werror=array-bounds]
  415 |   memset(constraints,0,sizeof(char)*NB_CONSTRAINTS);
      |   ^~~~~~
foo.c: In function 'function1':
foo.c:380:17: note: at offset 4 into object 'constraints' of size 5
  380 |   unsigned char constraints[NB_CONSTRAINTS];
      |                 ^~~~~~~~
cc1: all warnings being treated as errors


Curiously enough, I only see this issue in an i686 build. I don't get it on
x86-64. (Dropping -march=i686 does not help.)

  parent reply	other threads:[~2022-08-02  4:51 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-07-10 16:11 [Bug c++/106247] New: " 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 [this message]
2022-09-04  6:06 ` mwd at md5i dot com
2022-09-04  6:08 ` mwd at md5i dot com

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bug-106247-4-dhSRLYL9Jx@http.gcc.gnu.org/bugzilla/ \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).