[Bug 2073] New: Unnecessary check for alignment and unreachable code in cpukit/score/src/coremsg.c

Joel Sherrill joel.sherrill at OARcorp.com
Wed Aug 15 14:23:46 UTC 2012


On 08/15/2012 09:08 AM, Gedare Bloom wrote:
> Hi,
>
> Why remove the comment about rounding up the size?
>
The comment was poorly written. A better comment is desirable.
> Also, this code appears to have a latent bug that assumes the 
> size/alignment should be 32-bits.
>
> I think we should actually have
> +  allocated_message_size += sizeof(uintptr_t);
> +  allocated_message_size&= ~(sizeof(uintptr_t) - 1);
>
That's better.
> On Wed, Aug 15, 2012 at 5:16 AM, <bugzilla-daemon at rtems.org 
> <mailto:bugzilla-daemon at rtems.org>> wrote:
>
>     https://www.rtems.org/bugzilla/show_bug.cgi?id=2073
>
>                  Bug #: 2073
>                Summary: Unnecessary check for alignment and
>     unreachable code
>                         in cpukit/score/src/coremsg.c
>         Classification: Unclassified
>                Product: RTEMS
>                Version: 4.10
>               Platform: PC
>             OS/Version: Linux
>                 Status: NEW
>               Severity: enhancement
>               Priority: P3
>              Component: cpukit
>             AssignedTo: joel.sherrill at oarcorp.com
>     <mailto:joel.sherrill at oarcorp.com>
>             ReportedBy: krzysztof.miesowicz at gmail.com
>     <mailto:krzysztof.miesowicz at gmail.com>
>
>
>     Created attachment 1484
>       --> https://www.rtems.org/bugzilla/attachment.cgi?id=1484
>     Patch to remove unreachable code in coremsg.c
>
>     When analyzing coverage report
>     http://www.rtems.org/ftp/pub/rtems/people/joel/coverage/erc32/erc32-Ospd-20120714-1625/annotated.html#range2
>     I discovered that there is unreachable and unnecessary
>     if-statement. It gives 2
>     uncovered instructions. Checking if allocated_message_size is less
>     than
>     maximum_message_size is unnecessary as above code guarantee that
>     allocated_message_size will be equal or greater than
>     maximum_message_size.
>
>     I am sending patch as attachment.
>
>     --
>     Configure bugmail:
>     https://www.rtems.org/bugzilla/userprefs.cgi?tab=email
>     ------- You are receiving this mail because: -------
>     You are watching all bug changes.
>     _______________________________________________
>     rtems-bugs mailing list
>     rtems-bugs at rtems.org <mailto:rtems-bugs at rtems.org>
>     http://rtems.org/mailman/listinfo/rtems-bugs
>
>


-- 
Joel Sherrill, Ph.D.             Director of Research&   Development
joel.sherrill at OARcorp.com        On-Line Applications Research
Ask me about RTEMS: a free RTOS  Huntsville AL 35805
     Support Available             (256) 722-9985


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.rtems.org/pipermail/devel/attachments/20120815/5319df12/attachment-0001.html>


More information about the devel mailing list