Dear Zhou, Houi,
Thank you very much for your detailed analysis! It is indeed a bit strange.
I obtained that result using the beta version 16.0.0 20251216 (experimental)
of gcc/gfortran. In any case with the last configuration, that I transcribed in
my previous email, these warnings disappeared.
Thanks again and regards.
Jorge D'Elia.
"Zhou, Hui" <zhouh@anl.gov> escribió:
It can be ignored.
I am curious how the compiler arrive at that warning. 18446744071562067968 and 18446744073709551615 in hex are
0xFFFFFFFF80000000 and 0xFFFFFFFFFFFFFFFF, if we cast to unsigned int, they are 2147483648 - 4294967295, and
if we cast to signed int, they are -2147483648 - -1. So The compiler looked at the type ofupid_len, which is anint, and
decided it could have negative values, which will become in the range of0xFFFFFFFF80000000 and
0xFFFFFFFFFFFFFFFF and that exceeds maximum object size.
So they are complaining an implicit cast fromintto size_t inmemcpy. And they want us to add an explicit
`(unsigned) upid_len` cast, which does nothing in improving the code safety. In fact, it makes the code worse. Before, if we
accidentally had negative values inint,which is quite common in errors, the negative value will triggeran immediate errorin memcpy. With the cast to(unsigned), the negative values suddenly become good value for memcpy and it will happilycorrupt the memory! It is a warning designed to be silenced and force people to write bad code.
How stupid is that?
--Hui
From: jdelia--- via discuss <discuss@mpich.org>
Sent: Wednesday, February 4, 2026 5:37 PM
To: MPICH DISCUSS@MPICH.ORG <discuss@mpich.org>
Cc: jdelia@intec.unl.edu.ar <jdelia@intec.unl.edu.ar>
Subject: [mpich-discuss] MPICH 5.0.0 released: a warningThis Message Is From an External SenderThis message came from outside your organization.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 function ‘MPIDIU_upidhash_add’:../src/mpid/ch4/src/ch4_proc.c:336:5: warning: ‘memcpy’ specified bound between 18446744071562067968 and 18446744073709551615 exceeds maximum object size 9223372036854775807 [-Wstringop-overflow=]336 | memcpy(t->upid, upid, upid_len);| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
I'd like to know if it can be ignored, or if it would be better to fix it (and
how to do so). Thanks,
Regards.Jorge D'Elia.