This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug c/80406] New: Reduced false positive test case for -Warray-bounds with -O3


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80406

            Bug ID: 80406
           Summary: Reduced false positive test case for -Warray-bounds
                    with -O3
           Product: gcc
           Version: 6.2.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
          Assignee: unassigned at gcc dot gnu.org
          Reporter: brlcad at mac dot com
  Target Milestone: ---

Created attachment 41182
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=41182&action=edit
False positive, compile with: gcc -Warray-bounds -O3 -c
gcc_6-2-1_compiler_bug.c

This is yet another report of an -Warray-bounds false positive when compiling
with -O3.

Scanned possible dupes and there are obviously lots similar still open (e.g.,
63213, 66974, 77291), but none that seem (to me) exactly like the case I
encountered compiling BRL-CAD with 6.2.1 and 5.4.0.  I've reduced the code in
question and annotated the logic flow, attached.

Warning is not issued below -O3.  Warning is not issued with a boundary test
(npts <= MAX_HITS) in the "WARN PARENT LOOP".  In fact, changing nearly any
aspect of this simplified case seems to make the warning go away.

Particularly interesting, a warning is not issued if "ASSURANCE B" is enabled
on this simplified example, though it DOESN't quell our production code.  This
is interesting because it means the optimizer is (probably) correctly
identifying Assurance B as dead/unnecessary code, but then subsequently warns
in the WARN LOOP.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]