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

Gedare Bloom gedare at rtems.org
Wed Aug 15 14:08:31 UTC 2012


Hi,

Why remove the comment about rounding up the size?

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);


On Wed, Aug 15, 2012 at 5:16 AM, <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
>         ReportedBy: 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
> http://rtems.org/mailman/listinfo/rtems-bugs
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.rtems.org/pipermail/devel/attachments/20120815/1b0e18ca/attachment.html>


More information about the devel mailing list