Tcl Source Code

View Ticket
Login
Ticket UUID: 3545875
Title: Mac OSX clang compiler warning
Type: Bug Created on: 2012-07-19 13:37:35
Submitter: dgp Assigned to: msofer
Subsystem: 47. Bytecode Compiler Severity: Minor
Priority: 5 Medium Last modified: 2022-08-19 08:52:01
Status: Closed Closed by: chrstphrchvz
Resolution: Fixed Closed on: 2022-08-19 08:52:01
Version: obsolete: 8.5.12
Description:
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.
User Comments:
chrstphrchvz added on 2022-08-19 08:52:01:

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