[Bug tree-optimization/106247] GCC12 warning in Eigen: array subscript is partly outside array bounds
skunk at iskunk dot org
gcc-bugzilla@gcc.gnu.org
Tue Aug 2 04:51:29 GMT 2022
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.)
More information about the Gcc-bugs
mailing list