https://bugs.linaro.org/show_bug.cgi?id=3246

            Bug ID: 3246
           Summary: GCC 7 detected incorrect if statement
           Product: OpenDataPlane - linux- generic reference
           Version: api-next
          Hardware: Other
                OS: Linux
            Status: UNCONFIRMED
          Severity: critical
          Priority: Highest
         Component: Packet IO
          Assignee: ola.liljed...@linaro.org
          Reporter: bill.fischo...@linaro.org
                CC: dmitry.ereminsoleni...@linaro.org,
                    lng-odp@lists.linaro.org, maxim.uva...@linaro.org
  Target Milestone: ---

Attempting to compile the latest api-next with GCC 7 results in the following
error:

  CC       odp_packet_io.lo
odp_packet_io.c: In function ‘sched_cb_pktin_poll_one’:
odp_packet_io.c:705:4: error: this ‘if’ clause does not guard...
[-Werror=misleading-indentation]
    if (queue_fn->enq_multi(queue, &buf_hdr, 1) < 0)
    ^~
odp_packet_io.c:708:5: note: ...this statement, but the latter is misleadingly
indented as if it were guarded by the ‘if’
     __atomic_fetch_add(&entry->s.stats.in_discards,
     ^~~~~~~~~~~~~~~~~~
cc1: all warnings being treated as errors

The offending code is:

                if (odp_unlikely(pkt_hdr->p.input_flags.dst_queue)) {
                        queue = pkt_hdr->dst_queue;
                        buf_hdr = packet_to_buf_hdr(pkt);
                        if (queue_fn->enq_multi(queue, &buf_hdr, 1) < 0)
                                /* Queue full? */
                                odp_packet_free(pkt);
                                __atomic_fetch_add(&entry->s.stats.in_discards,
                                                   1,
                                                   __ATOMIC_RELAXED);
                } else {
                        evt_tbl[num_rx++] = odp_packet_to_event(pkt);
                }

I attempted to use git bisect, but discovered that Travis does not ensure that
patch series are bisectable and as a result git bisect breaks trying to isolate
the commit in error, however inspection shows that this was introduced in PR
https://github.com/Linaro/odp/pull/161

Assigning bug to Ola for analysis and fix. I suspect the intent is correct and
the root issue is the if statement should have braces to enclose both
statements.

Adding Maxim and Dmitry to this to investigate two derivative Travis issues:

1. We need Travis to test with both GCC 7 and clang 4.0 to ensure these sort of
errors are detected

2. Need to investigate how to ensure that multi-commit PRs are verified to be
bisectable.

-- 
You are receiving this mail because:
You are on the CC list for the bug.

Reply via email to