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

Michael Duggan <mwd at md5i dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |mwd at md5i dot com

--- Comment #7 from Michael Duggan <mwd at md5i dot com> ---
I am working with some code that exhibits a similar problem.  I've run creduce
on the preprocessed code to create an exemplar, which I have attached as
bug-mwd.cpp.  Here's the relevant warnings from g++ 12.2.0 using '-std=c++14
-Wall -O2':

In member function ‘void i< <template-parameter-1-1> >::m(k*) [with ab = s]’,
    inlined from ‘void i< <template-parameter-1-1> >::m(k*) [with ab = I]’ at
bug.cpp:25:26,
    inlined from ‘i< <template-parameter-1-1> >::i(n) [with n = I*; ab = I]’ at
bug.cpp:23:39,
    inlined from ‘am I::u()’ at bug.cpp:48:3:
bug.cpp:27:5: warning: array subscript ‘i<s>::k {aka s}[0]’ is partly outside
array bounds of ‘unsigned char [40]’ [-Warray-bounds]
   27 |     e(p->aa);
      |     ^~~~~~~~
bug.cpp: In member function ‘am I::u()’:
bug.cpp:48:9: note: object of size 40 allocated by ‘operator new’
   48 |   o(new I);
      |         ^

The example is convoluted, I am afraid.  One very strange bit is that if I
change the 'o's in 'class I' to, say, 'p', I get a completely different error.

If you think this is unrelated, let me know, and I will submit a new bug
report.

Reply via email to