Skip to content
Tcl Source Code View Ticket
Login

View Ticket

2022-08-19
08:52 • Closed ticket [3545875fff]: Mac OSX clang compiler warning plus 8 other chan... artifact: e15166be82 user: chrstphrchvz
2012-07-19
13:37 • New ticket [3545875fff]. artifact: 99e69c926f user: dgp

Mac OSX clang compiler warning

Closed / Fixed3545875fffffffffffffffffffffffffffffffffCreated 14 years agoUpdated 4 years ago
Descriptionplain2012-07-19 13:37:35
Forwarded from Gustaf Neumann:

% clang --version
Apple clang version 3.1 (tags/Apple/clang-318.0.58) (based on LLVM 3.1svn)


/usr/local/src/tcl8.5.12/unix/../generic/tclExecute.c:727:22: warning: array index of '-1' indexes before the beginning of the array [-Warray-bounds]
     esPtr->tosPtr = &esPtr->stackWords[-1];
                      ^                 ~~
/usr/local/src/tcl8.5.12/unix/../generic/tclInt.h:1319:5: note: array 'stackWords' declared here
     Tcl_Obj *stackWords[1];
     ^
/usr/local/src/tcl8.5.12/unix/../generic/tclExecute.c:939:31: warning: array index of '-1' indexes before the beginning of the array [-Warray-bounds]
         currElems = esPtr->endPtr - &esPtr->stackWords[-1];
                                      ^                 ~~
/usr/local/src/tcl8.5.12/unix/../generic/tclInt.h:1319:5: note: array 'stackWords' declared here
     Tcl_Obj *stackWords[1];
     ^
/usr/local/src/tcl8.5.12/unix/../generic/tclExecute.c:940:45: warning: array index of '-1' indexes before the beginning of the array [-Warray-bounds]
         if (esPtr->markerPtr || (esPtr->tosPtr != &esPtr->stackWords[-1])) {
                                                    ^                 ~~
/usr/local/src/tcl8.5.12/unix/../generic/tclInt.h:1319:5: note: array 'stackWords' declared here
     Tcl_Obj *stackWords[1];
     ^
/usr/local/src/tcl8.5.12/unix/../generic/tclExecute.c:952:31: warning: array index of '-1' indexes before the beginning of the array [-Warray-bounds]
         currElems = esPtr->endPtr - &esPtr->stackWords[-1];
                                      ^                 ~~
/usr/local/src/tcl8.5.12/unix/../generic/tclInt.h:1319:5: note: array 'stackWords' declared here
     Tcl_Obj *stackWords[1];
     ^
/usr/local/src/tcl8.5.12/unix/../generic/tclExecute.c:1094:22: warning: array index of '-1' indexes before the beginning of the array [-Warray-bounds]
     esPtr->tosPtr = &esPtr->stackWords[-1];
                      ^                 ~~
/usr/local/src/tcl8.5.12/unix/../generic/tclInt.h:1319:5: note: array 'stackWords' declared here
     Tcl_Obj *stackWords[1];
     ^
5 warnings generated.

If there's a sensible way to make the code better without
negative indexing, it will quiet the compiler.  Not urgent.
chrstphrchvzwiki2022-08-19 08:52:01

Closing: this was ultimately addressed by [49a45d782ef9] for 8.5 and by [f5a69fee4db2] for 8.6.

Log in (anonymous is fine) to add a comment.