[llvm-bugs] [Bug 26178] New: Erroneous clang -Warray-bounds warning when preprocessing its own output (Triggered by ccache)

via llvm-bugs llvm-bugs at lists.llvm.org
Sat Jan 16 11:40:02 PST 2016


https://llvm.org/bugs/show_bug.cgi?id=26178

            Bug ID: 26178
           Summary: Erroneous clang -Warray-bounds warning when
                    preprocessing its own output (Triggered by ccache)
           Product: clang
           Version: 3.7
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: -New Bugs
          Assignee: unassignedclangbugs at nondot.org
          Reporter: shlomif at shlomifish.org
                CC: llvm-bugs at lists.llvm.org
    Classification: Unclassified

Hi all, please see:

* https://github.com/shlomif/ccache-clang-stray-Warray-bounds-warning-bug

* https://bugzilla.samba.org/show_bug.cgi?id=11674

When running the following command on the input (available using make bad
SYSTEM_CLANG=/path/to/clang:

/usr/bin/clang -Warray-bounds -DFCS_COMPILE_DEBUG_FUNCTIONS=1 \
-DFCS_DBM_USE_LIBAVL=1 -DFCS_DBM_WITHOUT_CACHES=1 -DFCS_DEBONDT_DELTA_STATES=1
\
 -O2 -g -DNDEBUG   -fvisibility=hidden -march=corei7-avx -fomit-frame-pointer \
-E pi_make_microsoft_freecell_board.c -o pi_make_microsoft_freecell_board.i &&
\
/usr/bin/clang -DFCS_COMPILE_DEBUG_FUNCTIONS=1 -DFCS_DBM_USE_LIBAVL=1 \
-DFCS_DBM_WITHOUT_CACHES=1 -DFCS_DEBONDT_DELTA_STATES=1  -O2 -g -DNDEBUG   \
-fvisibility=hidden -march=corei7-avx -fomit-frame-pointer -c \

I am getting a warning:

pi_make_microsoft_freecell_board.i
pi_make_microsoft_freecell_board.c:168:2087: warning: array index 3 is past the
      end of the array (which contains 3 elements) [-Warray-bounds]
  ...__result = (((const unsigned char *) (const char *) ("-t"))[3] -
__s2[3]...
                                                          ^      ~
1 warning generated.
shlomif at telaviv1:~/Download/unpack/ccache-clang-stray-Warray-bounds-warning-bug$ 

I'm on Mageia Linux x86-64 v6 using clang from llvm-3.7.1-3.mga6.src.rpm .

Please look into it. Thank to Joel Rosdahl for some investigation and insights.

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20160116/31fc98ab/attachment.html>


More information about the llvm-bugs mailing list