Bug 47044

Summary: [Patch] apr_snprintf.c compile failure on AIX maintainer_mode with xlc_r v7.0
Product: APR Reporter: Dan Poirier <poirier>
Component: APRAssignee: Apache Portable Runtime bugs mailinglist <bugs>
Status: NEW ---    
Severity: normal CC: poirier
Priority: P2 Keywords: PatchAvailable
Version: HEAD   
Target Milestone: ---   
Hardware: PC   
OS: AIX   
Attachments: Patch to fix compile error

Description Dan Poirier 2009-04-17 05:26:50 UTC
Created attachment 23503 [details]
Patch to fix compile error

Compile fails on AIX when configured with "--enable-maintainer-mode" and using compiler xlc_r "@(#) IBM XL C/C++ Enterprise Edition V7.0":

"strings/apr_snprintf.c", line 580.31: 1506-1298 (S) The subscript 10 is out of range. The valid range is 0 to 9.

and about a dozen more lines.

The error occurs where the address of an array element past the end of the array is taken.  

Changing the code from &array[LENGTH] to array+LENGTH quiets the compile error, and should be equivalent in function.  With the change it still compiles fine on Linux; haven't tried elsewhere.

Patch attached.