Project

General

Profile

Actions

Bug #5693

closed

clang warning in bigdecimal

Added by drbrain (Eric Hodel) over 12 years ago. Updated almost 12 years ago.

Status:
Closed
Target version:
-
ruby -v:
-
Backport:
[ruby-core:41418]

Description

When bigdecimal is compiled under clang I get this warning:

/Users/drbrain/Work/svn/ruby/trunk/ext/bigdecimal
compiling bigdecimal.c
bigdecimal.c:4364:37: warning: array index of '1' indexes past the end of an
array (that contains 1 elements) [-Warray-bounds]
b1b2p1 = b1b2 = b1 * BASE + b->frac[1];
^ ~
./bigdecimal.h:147:5: note: array 'frac' declared here
BDIGIT frac[1]; /* Pointer to array of fraction part. */
^
../.././include/ruby/defines.h:93:17: note: instantiated from:

define BDIGIT unsigned int

           ^

1 warning generated.
linking shared-object bigdecimal.bundle
installing default bigdecimal libraries

Paste of warning in case spacing is munged: http://paste.segment7.net/or.html

I'm using Apple clang 3.0:

$ clang -v
Apple clang version 3.0 (tags/Apple/clang-211.10.1) (based on LLVM 3.0svn)
Target: x86_64-apple-darwin11.2.0
Thread model: posix

I dug around in the bigdecimal and it seems that frac is modified to point to a larger array, but perhaps clang has detected a scenario where it is not modified?

Actions

Also available in: Atom PDF

Like0
Like0Like0