msvcirt: Avoid "array subscript above array bounds" warnings in test_ostrstream and test_strstreambuf.

Gerald Pfeifer gerald at pfeifer.com
Sat Dec 24 16:10:58 CST 2016


Hi Piotr,

On Fri, 4 Nov 2016, Piotr Caban wrote:
> sorry for long reply time.

sorry, now it's taken me a while due to travel and other things),
and...

>> -    ok(ssb1.base.ebuf == buffer + 0x7fffffff || ssb1.base.ebuf == (char*)-1,
>> +    ok((size_t)ssb1.base.ebuf == (size_t)buffer + 0x7fffffff || ssb1.base.ebuf == (char*)-1,
> Is casting buffer to char* enough to get away with the warning? I think I
> would prefer it to be done this way if it works.

...I believe I tried this and it did not work.  On the positive side,
Alexandre ran into this now as well and fixed it two days ago, so you
and me can close this. ;-)  (Thanks, Alexandre!)

  commit c28816cc378a580258bfb35a8fc8a32d1b40afde
  Author: Alexandre Julliard <julliard at winehq.org>
  Date:   Thu Dec 22 15:07:05 2016 +0100

  msvcirt/tests: Silence a compiler warning.

Filip, from what I have seen, this should also address what you
reported below?

Gerald

On Thu, 10 Nov 2016, Filip Frackiewicz wrote:
> In wine-1.9.22-129-g906e770 I see the array subscript warnings in the
> following location:
> 
> ../../../../wine/dlls/msvcirt/tests/msvcirt.c: In function ‘test_strstream’:
> ../../../../wine/dlls/msvcirt/tests/msvcirt.c:6861:34: warning: array
> subscript is above array bounds [-Warray-bounds]
>      ok(pssb->base.ebuf == buffer + 0x7fffffff || pssb->base.ebuf == (char*) -1,
>                            ~~~~~~~^~~~~~~~~~~~
> ../../../../wine/dlls/msvcirt/tests/msvcirt.c:6868:35: warning: array
> subscript is above array bounds [-Warray-bounds]
>      ok(pssb->base.epptr == buffer + 0x7fffffff || pssb->base.epptr ==
> (char*) -1,


More information about the wine-devel mailing list