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