[前][次][番号順一覧][スレッド一覧]

ruby-changes:60707

From: Yusuke <ko1@a...>
Date: Thu, 9 Apr 2020 09:43:00 +0900 (JST)
Subject: [ruby-changes:60707] 9af3469b84 (master): internal/bits.h: Suppress "uninitialized variable"

https://git.ruby-lang.org/ruby.git/commit/?id=9af3469b84

From 9af3469b84d6220ef30ffc2b3709806f90edaf41 Mon Sep 17 00:00:00 2001
From: Yusuke Endoh <mame@r...>
Date: Thu, 9 Apr 2020 09:38:57 +0900
Subject: internal/bits.h: Suppress "uninitialized variable"

Coverity Scan says "Using uninitialized value c.fixnum when calling
__builtin_mul_overflow_p."

diff --git a/internal/bits.h b/internal/bits.h
index 32ec1cd..28c668d 100644
--- a/internal/bits.h
+++ b/internal/bits.h
@@ -112,7 +112,7 @@ https://github.com/ruby/ruby/blob/trunk/internal/bits.h#L112
 /* and GCC permits bitfields for integers other than int */
 # define MUL_OVERFLOW_FIXNUM_P(a, b) \
     __extension__ ({ \
-        struct { long fixnum : sizeof(long) * CHAR_BIT - 1; } c; \
+        struct { long fixnum : sizeof(long) * CHAR_BIT - 1; } c = { 0 }; \
         __builtin_mul_overflow_p((a), (b), c.fixnum); \
     })
 #else
-- 
cgit v0.10.2


--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]