Tarantool development patches archive
 help / color / mirror / Atom feed
From: "Alexander Turenko" <alexander.turenko@tarantool.org>
To: "Konstantin Osipov" <kostja@tarantool.org>
Cc: tarantool-patches <tarantool-patches@freelists.org>,
	"Georgy Kirichenko" <georgy@tarantool.org>
Subject: [tarantool-patches] Re: [tarantool-patches] Re: [PATCH] Suppress -Warray-bounds warning on unit/guard.cc
Date: Thu, 16 May 2019 20:25:36 +0300	[thread overview]
Message-ID: <1558027536.549839856@f275.i.mail.ru> (raw)
In-Reply-To: <20190515023117.GN3801@atlas>

Sorry, missed the message. Please, leave me in To or CC, otherwise I can miss a message.

>Среда, 15 мая 2019, 5:31 +03:00 от Konstantin Osipov <kostja@tarantool.org>:
>
>* Alexander Turenko < alexander.turenko@tarantool.org > [19/05/15 04:21]:
>> This warning breaks -Werror -O2 build on GCC 9.1.
>
>Why not fix the code?

I did think that unit/guard.cc really need to look outside of an array
bounds, my bad.

Is the following way to fix is okay (pushed to Totktonada/fix-gcc-9-warnings)?

CCed Georgy.

commit ae705eff77c57dc36149f659b066a6f6abea4d3d
Author: Alexander Turenko <alexander.turenko@tarantool.org>
Date:   Tue May 14 23:28:05 2019 +0300

    Eliminate -Warray-bounds warning on unit/guard.cc
    
    This warning breaks -Werror -O2 build on GCC 9.1.

diff --git a/test/unit/guard.cc b/test/unit/guard.cc
index 24ab1fc2e..a2953b829 100644
--- a/test/unit/guard.cc
+++ b/test/unit/guard.cc
@@ -21,7 +21,7 @@ stack_break_f(char *ptr)
 	 */
 	volatile char sum = 0;
 	memset(block, 0xff, 2048);
-	sum += block[block[4]];
+	sum += block[(unsigned char) block[4]];
 	ptrdiff_t stack_diff = ptr > block ? ptr - block : block - ptr;
 	if (stack_diff < (ptrdiff_t)default_attr.stack_size)
 		sum += stack_break_f(ptr);

  reply	other threads:[~2019-05-16 17:25 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-05-14 20:57 [tarantool-patches] " Alexander Turenko
2019-05-15  2:31 ` [tarantool-patches] " Konstantin Osipov
2019-05-16 17:25   ` Alexander Turenko [this message]
2019-05-29 15:06 ` Kirill Yukhin

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=1558027536.549839856@f275.i.mail.ru \
    --to=alexander.turenko@tarantool.org \
    --cc=georgy@tarantool.org \
    --cc=kostja@tarantool.org \
    --cc=tarantool-patches@freelists.org \
    --subject='[tarantool-patches] Re: [tarantool-patches] Re: [PATCH] Suppress -Warray-bounds warning on unit/guard.cc' \
    /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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox