Project

General

Profile

Bug #5693

clang warning in bigdecimal

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

Status:
Closed
Priority:
Normal
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?

History

Updated by naruse (Yui NARUSE) about 8 years ago

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

Updated by mrkn (Kenta Murata) over 7 years ago

  • Status changed from Assigned to Closed

This is fixed by r33915

Also available in: Atom PDF