Tarantool development patches archive
 help / color / mirror / Atom feed
* [tarantool-patches] [PATCH] Suppress -Warray-bounds warning on unit/guard.cc
@ 2019-05-14 20:57 Alexander Turenko
  2019-05-15  2:31 ` [tarantool-patches] " Konstantin Osipov
  2019-05-29 15:06 ` Kirill Yukhin
  0 siblings, 2 replies; 4+ messages in thread
From: Alexander Turenko @ 2019-05-14 20:57 UTC (permalink / raw)
  To: Kirill Yukhin; +Cc: Alexander Turenko, tarantool-patches

This warning breaks -Werror -O2 build on GCC 9.1.
---

no issue
https://github.com/tarantool/tarantool/tree/Totktonada/fix-gcc-9-warnings

 test/unit/CMakeLists.txt | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/test/unit/CMakeLists.txt b/test/unit/CMakeLists.txt
index 07dcd6cf2..2f670033c 100644
--- a/test/unit/CMakeLists.txt
+++ b/test/unit/CMakeLists.txt
@@ -77,6 +77,9 @@ if (NOT ENABLE_GCOV)
     # This test is known to be broken with GCOV
     add_executable(guard.test guard.cc)
     target_link_libraries(guard.test core unit)
+    set_source_files_properties(
+        guard.cc
+        PROPERTIES COMPILE_FLAGS -Wno-array-bounds)
 endif ()
 
 add_executable(fiber_stress.test fiber_stress.cc)
-- 
2.21.0

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [tarantool-patches] Re: [PATCH] Suppress -Warray-bounds warning on unit/guard.cc
  2019-05-14 20:57 [tarantool-patches] [PATCH] Suppress -Warray-bounds warning on unit/guard.cc Alexander Turenko
@ 2019-05-15  2:31 ` Konstantin Osipov
  2019-05-16 17:25   ` [tarantool-patches] " Alexander Turenko
  2019-05-29 15:06 ` Kirill Yukhin
  1 sibling, 1 reply; 4+ messages in thread
From: Konstantin Osipov @ 2019-05-15  2:31 UTC (permalink / raw)
  To: tarantool-patches

* 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?


-- 
Konstantin Osipov, Moscow, Russia, +7 903 626 22 32

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [tarantool-patches] Re: [tarantool-patches] Re: [PATCH] Suppress -Warray-bounds warning on unit/guard.cc
  2019-05-15  2:31 ` [tarantool-patches] " Konstantin Osipov
@ 2019-05-16 17:25   ` Alexander Turenko
  0 siblings, 0 replies; 4+ messages in thread
From: Alexander Turenko @ 2019-05-16 17:25 UTC (permalink / raw)
  To: Konstantin Osipov; +Cc: tarantool-patches, Georgy Kirichenko

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);

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [tarantool-patches] Re: [PATCH] Suppress -Warray-bounds warning on unit/guard.cc
  2019-05-14 20:57 [tarantool-patches] [PATCH] Suppress -Warray-bounds warning on unit/guard.cc Alexander Turenko
  2019-05-15  2:31 ` [tarantool-patches] " Konstantin Osipov
@ 2019-05-29 15:06 ` Kirill Yukhin
  1 sibling, 0 replies; 4+ messages in thread
From: Kirill Yukhin @ 2019-05-29 15:06 UTC (permalink / raw)
  To: Alexander Turenko; +Cc: tarantool-patches

Hello,

On 14 May 23:57, Alexander Turenko wrote:
> This warning breaks -Werror -O2 build on GCC 9.1.
> ---
> 
> no issue
> https://github.com/tarantool/tarantool/tree/Totktonada/fix-gcc-9-warnings

I've checked your patch into 1.10, 2.1 and master.

--
Regards, Kirill Yukhin

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2019-05-29 15:06 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-05-14 20:57 [tarantool-patches] [PATCH] Suppress -Warray-bounds warning on unit/guard.cc Alexander Turenko
2019-05-15  2:31 ` [tarantool-patches] " Konstantin Osipov
2019-05-16 17:25   ` [tarantool-patches] " Alexander Turenko
2019-05-29 15:06 ` Kirill Yukhin

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