#3581 closed defect (fixed)

Structurally dead code in fifo.c (CID 1437649 )

Reported by: shashvat jain Owned by: Joel Sherrill <joel@…>
Priority: normal Milestone: Indefinite
Component: lib/block Version: 6
Severity: normal Keywords: Coverity
Cc: Blocked By:
Blocking:

Description

As per coverity scan at ​https://scan.coverity.com/projects/rtems ,CID 1437649 , line 103 in fifo.c is unreachable and the code is called to be structurally dead. You will need an Coverity Scan account and permission to view RTEMS to see more details.
all the "goto" statements are present , the problem could have arised due to
syntax issue like "indentation" or due to a problem in upstream files.the code in question is:
100 c = 'a';
101 return 0;
102

CID 1437649 (#1 of 1): Structurally dead code (UNREACHABLE)
unreachable: This code cannot be reached: rtems_barrier_delete(pipe->....
103 rtems_barrier_delete(pipe->writeBarrier);
104err_wbar:
105 rtems_barrier_delete(pipe->readBarrier);
106err_rbar:
107 free(pipe->Buffer);
108err_buf:
109 free(pipe);
110 return err;
111}

Change History (2)

comment:1 Changed on Nov 3, 2018 at 3:20:28 PM by Joel Sherrill

Line 103 does indeed appear to be dead. It is in between a return 0 and a label. There is no way to get there.

comment:2 Changed on Nov 22, 2018 at 3:59:41 PM by Joel Sherrill <joel@…>

Owner: set to Joel Sherrill <joel@…>
Resolution: fixed
Status: newclosed

In 9dfb9a98/rtems:

pipe/fifo.c: Remove dead code (CID 1437649)

Closes #3581.

Note: See TracTickets for help on using tickets.