<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<style type="text/css" style="display:none;"> P {margin-top:0;margin-bottom:0;} </style>
</head>
<body dir="ltr">
<div style="font-family: Aptos, Aptos_EmbeddedFont, Aptos_MSFontService, Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);" class="elementToProof">
It can be ignored.<br>
<br>
I am curious how the compiler arrive at that warning. 18446744071562067968 and 18446744073709551615 in hex are<br>
0xFFFFFFFF80000000 and 0xFFFFFFFFFFFFFFFF, if we cast to unsigned int, they are 2147483648 - 4294967295, and<br>
if we cast to signed int, they are -2147483648 - -1. So The compiler looked at the type of
<code>upid_len</code>, which is an <code>int, and</code><br>
<code>decided it could have negative values, which will become in the range of </code>
0xFFFFFFFF80000000 and<br>
0xFFFFFFFFFFFFFFFF and that exceeds maximum object size.<br>
<br>
So they are complaining an implicit cast from <code>int</code> to size_t in <code>
memcpy. And they want us to add an explicit</code><br>
`(unsigned) upid_len` cast, which does nothing in improving the code safety. In fact, it makes the code worse. Before, if we<br>
accidentally had negative values in <code>int, </code><code style="font-family: Aptos, Aptos_EmbeddedFont, Aptos_MSFontService, Calibri, Helvetica, sans-serif;">which is quite common in errors, the negative value will trigger
</code>an immediate error</div>
<div style="font-family: Aptos, Aptos_EmbeddedFont, Aptos_MSFontService, Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);" class="elementToProof">
in memcpy. With the cast to <code>(unsigned)</code>, the negative values suddenly become good value for memcpy and it will happily</div>
<div style="font-family: Aptos, Aptos_EmbeddedFont, Aptos_MSFontService, Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);" class="elementToProof">
corrupt the memory! It is a warning designed to be silenced and force people to write bad code.<br>
<br>
How stupid is that?<br>
<br>
-- </div>
<div style="font-family: Aptos, Aptos_EmbeddedFont, Aptos_MSFontService, Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);" class="elementToProof">
Hui</div>
<div id="appendonsend"></div>
<hr style="display:inline-block;width:98%" tabindex="-1">
<div id="divRplyFwdMsg" dir="ltr"><font face="Calibri, sans-serif" style="font-size:11pt" color="#000000"><b>From:</b> jdelia--- via discuss <discuss@mpich.org><br>
<b>Sent:</b> Wednesday, February 4, 2026 5:37 PM<br>
<b>To:</b> MPICH DISCUSS@MPICH.ORG <discuss@mpich.org><br>
<b>Cc:</b> jdelia@intec.unl.edu.ar <jdelia@intec.unl.edu.ar><br>
<b>Subject:</b> [mpich-discuss] MPICH 5.0.0 released: a warning</font>
<div> </div>
</div>
<div>
<div style="display:none!important; display:none; visibility:hidden; font-size:1px; color:#ffffff; line-height:1px; height:0px; max-height:0px; opacity:0; overflow:hidden">
Hi there, Today I downloaded the [mpich-announce] MPICH 5. 0. 0 released on a x86_64-pc-linux-gnu Linux machine with Fedora 43. Although the building is fine, the following warning appears during compilation: .. /src/mpid/ch4/src/ch4_proc. c: In</div>
<div style="display:none!important; display:none; visibility:hidden; font-size:1px; color:#ffffff; line-height:1px; max-height:0px; opacity:0; overflow:hidden">
ZjQcmQRYFpfptBannerStart</div>
<div dir="ltr" id="x_pfptBannerx64dbz2" style="display:block!important; text-align:left!important; margin:16px 0px 16px 0px!important; padding:8px 16px 8px 16px!important; border-radius:4px!important; min-width:200px!important; background-color:#D0D8DC!important; background-color:#D0D8DC; border-top:4px solid #90a4ae!important; border-top:4px solid #90a4ae">
<div id="x_pfptBannerx64dbz2" style="float:left!important; display:block!important; margin:0px 0px 1px 0px!important; max-width:600px!important">
<div id="x_pfptBannerx64dbz2" style="display:block!important; visibility:visible!important; background-color:#D0D8DC!important; color:#000000!important; color:#000000; font-family:'Arial',sans-serif!important; font-family:'Arial',sans-serif; font-weight:bold!important; font-weight:bold; font-size:14px!important; line-height:18px!important; line-height:18px">
This Message Is From an External Sender </div>
<div id="x_pfptBannerx64dbz2" style="display:block!important; visibility:visible!important; background-color:#D0D8DC!important; color:#000000!important; color:#000000; font-weight:normal; font-family:'Arial',sans-serif!important; font-family:'Arial',sans-serif; font-size:12px!important; line-height:18px!important; line-height:18px; margin-top:2px!important">
This message came from outside your organization. </div>
</div>
<div style="clear:both!important; display:block!important; visibility:hidden!important; line-height:0!important; font-size:0.01px!important; height:0px">
</div>
</div>
<div style="display:none!important; display:none; visibility:hidden; font-size:1px; color:#ffffff; line-height:1px; max-height:0px; opacity:0; overflow:hidden">
ZjQcmQRYFpfptBannerEnd</div>
<style>
<!--
#x_pfptBannerx64dbz2
{display:block!important;
visibility:visible!important;
opacity:1!important;
background-color:#D0D8DC!important;
max-width:none!important;
max-height:none!important}
-->
</style>
<p>Hi there,<br>
<br>
Today I downloaded the [mpich-announce] MPICH 5.0.0 released<br>
on a x86_64-pc-linux-gnu Linux machine with Fedora 43. <br>
<br>
Although the building is fine, the following warning appears during compilation:<br>
<br>
</p>
<div>../src/mpid/ch4/src/ch4_proc.c: In function ‘MPIDIU_upidhash_add’:</div>
<div>../src/mpid/ch4/src/ch4_proc.c:336:5: warning: ‘memcpy’ specified bound between 18446744071562067968 and 18446744073709551615 exceeds maximum object size 9223372036854775807 [-Wstringop-overflow=]</div>
<div> 336 | memcpy(t->upid, upid, upid_len);</div>
<div> | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~</div>
<div><br>
I'd like to know if it can be ignored, or if it would be better to fix it (and<br>
how to do so). Thanks,<br>
<br>
Regards.</div>
<p>Jorge D'Elia.<br>
<br>
</p>
</div>
</body>
</html>