root icon indicating copy to clipboard operation
root copied to clipboard

[fortran] explore if occassional memory corruption issue stems from substring replacement

Open ferdymercury opened this issue 8 months ago • 2 comments

This Pull request:

Changes or fixes:

By adding a space, we create an extra char that, on Fortran's side will be substituted by c, rather than appending to the string.

Related discussion: https://github.com/root-project/root/pull/15915/files

Fixes https://github.com/root-project/root/issues/15422 Fixes https://github.com/root-project/root/issues/14155

Outstanding asan diagnostics:

 /github/home/ROOT-CI/src/misc/minicern/src/cernlib.c:82:18: runtime error: left shift of negative value -2012982016
  /github/home/ROOT-CI/src/misc/minicern/src/cernlib.c:83:18: runtime error: left shift of negative value -2012982016
  /github/home/ROOT-CI/src/misc/minicern/src/cernlib.c:100:12: runtime error: left shift of 1212370737 by 8 places cannot be represented in type 'int'
  /github/home/ROOT-CI/src/misc/minicern/src/cernlib.c:100:39: runtime error: left shift of 1212370737 by 24 places cannot be represented in type 'int'
  /github/home/ROOT-CI/src/misc/minicern/src/zebra.f:6746:72: runtime error: load of address 0x5560461bae2c with insufficient space for an object of type 'integer(kind=4)'
  0x5560461bae2c: note: pointer points here
    24 02 00 00 18 2f 0f 00  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00
                ^ 
  /github/home/ROOT-CI/src/misc/minicern/src/zebra.f:6747:72: runtime error: load of address 0x5560461bae2c with insufficient space for an object of type 'integer(kind=4)'
  0x5560461bae2c: note: pointer points here
    24 02 00 00 18 2f 0f 00  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00
                ^ 
  /github/home/ROOT-CI/src/misc/minicern/src/zebra.f:6753:72: runtime error: store to address 0x5560461bae2c with insufficient space for an object of type 'integer(kind=4)'
  0x5560461bae2c: note: pointer points here
    24 02 00 00 18 2f 0f 00  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00
                ^ 

ferdymercury avatar Apr 02 '25 12:04 ferdymercury

Test Results

    20 files      20 suites   3d 18h 32m 0s ⏱️  3 045 tests  3 042 ✅ 0 💤  3 ❌ 59 238 runs  59 226 ✅ 0 💤 12 ❌

For more details on these failures, see this check.

Results for commit e06b2ecc.

:recycle: This comment has been updated with latest results.

github-actions[bot] avatar Apr 02 '25 12:04 github-actions[bot]

@pcanal @hageboeck @couet @guitargeek In MacOS, I am seeing Library not loaded: @rpath/libgfortran.5.dylib and ld: warning: ignoring duplicate libraries: '-lemutls_w', '-lgcc', '-lgfortran', '-lquadmath' Do you know if this has something to do with incremental building? Or is it an issue with CMake not properly setting the rpath? Maybe related: https://github.com/scipy/scipy/issues/19387#issuecomment-1763399481

ferdymercury avatar Jun 17 '25 13:06 ferdymercury

Outstanding asan diagnostics:

We should open a issue to record those.

pcanal avatar Jun 18 '25 18:06 pcanal

LGTM.

What about the libgfortran dyld failure on mac?

ferdymercury avatar Jun 18 '25 18:06 ferdymercury

Outstanding asan diagnostics:

We should open a issue to record those.

added to https://github.com/root-project/root/issues/14682

ferdymercury avatar Jun 18 '25 18:06 ferdymercury

What about the libgfortran dyld failure on mac?

We indeed need to 'fix' that part before merging.

pcanal avatar Jun 18 '25 18:06 pcanal

@ferdymercury

@pcanal @hageboeck @couet @guitargeek In MacOS, I am seeing Library not loaded: @rpath/libgfortran.5.dylib

I see this message on the CI build for instance on macphsft31. I checked on that one and gfortran seems properlly installed:

sftnight@macphsft31 ~ % which gfortran                                      
/usr/local/bin/gfortran
sftnight@macphsft31 ~ % ls -l /usr/local/lib/*for*
lrwxr-xr-x  1 root  wheel  43 Mar 20  2024 /usr/local/lib/libgfortran.5.dylib -> /usr/local/gfortran/lib/libgfortran.5.dylib
sftnight@macphsft31 ~ % ls -l /usr/local/gfortran/lib/libgfortran.5.dylib
-rwxr-xr-x  1 root  wheel  1847232 Nov 18  2022 /usr/local/gfortran/lib/libgfortran.5.dylib
sftnight@macphsft31 ~ % 

I checked the other Macs : It is the same

couet avatar Jun 23 '25 08:06 couet

@pcanal @hageboeck @couet @guitargeek In MacOS, I am seeing Library not loaded: @rpath/libgfortran.5.dylib

I see this message on the CI build for instance on macphsft31. I checked on that one and gfortran seems properlly installed:

sftnight@macphsft31 ~ % which gfortran                                      
/usr/local/bin/gfortran
sftnight@macphsft31 ~ % ls -l /usr/local/lib/*for*
lrwxr-xr-x  1 root  wheel  43 Mar 20  2024 /usr/local/lib/libgfortran.5.dylib -> /usr/local/gfortran/lib/libgfortran.5.dylib
sftnight@macphsft31 ~ % ls -l /usr/local/gfortran/lib/libgfortran.5.dylib
-rwxr-xr-x  1 root  wheel  1847232 Nov 18  2022 /usr/local/gfortran/lib/libgfortran.5.dylib
sftnight@macphsft31 ~ % 

I checked the other Macs : It is the same

Could it be that this related to https://github.com/root-project/root/issues/19134 ?

@guitargeek should I try to apply your https://github.com/root-project/root/pull/19135/ here?

ferdymercury avatar Jun 24 '25 11:06 ferdymercury

I don't think adding something hardcoded to the RPATH is a good idea here, because on the users system the libfortran.so might be in a different place. I think the solution is to just set the paths for the test environment correctly:

https://github.com/root-project/root/pull/19174

But let's see if that actually works :laughing:

guitargeek avatar Jun 25 '25 11:06 guitargeek