Bug #5693

clang warning in bigdecimal

Added by drbrain (Eric Hodel) over 8 years ago. Updated about 8 years ago.

Target version:
ruby -v:


When bigdecimal is compiled under clang I get this warning:

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:

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?

Updated by naruse (Yui NARUSE) over 8 years ago

  • Category set to ext
  • Status changed from Open to Assigned
  • Assignee set to mrkn (Kenta Murata)

Updated by mrkn (Kenta Murata) about 8 years ago

  • Status changed from Assigned to Closed

This is fixed by r33915

Also available in: Atom PDF