code-saturne / code_saturne

code_saturne public mirror
https://www.code-saturne.org
GNU General Public License v2.0
218 stars 81 forks source link

Format in verini.f90 causes SIGSEGV or SIGABRT #84

Closed welucas2 closed 3 years ago

welucas2 commented 3 years ago

I've been helping a user on ARCHER2 who had been experiencing seg faults in their Code_Saturne run. Their case produces lots of warnings, triggering the following code: https://github.com/code-saturne/code_saturne/blob/734dbbafa8fb5072d434ec5ef552d2bb06a11af0/src/base/verini.f90#L261-L277

This references the following FORMAT statement: https://github.com/code-saturne/code_saturne/blob/734dbbafa8fb5072d434ec5ef552d2bb06a11af0/src/base/verini.f90#L988-L1019

The write and format do not match. In particular, it seems that 'THETRO' in the format statement is not being printed. On ARCHER2, this results in executables built with GCC 10.1.0 producing a SEGFAULT when this warning is produced, while CCE 10.0.4 results in SIGABRT, with no useful output.

I'm not sure what meaningful variable should be used for THETRO, but simply adding 0. in its place prevents the run crashing out:

    write(nfecra,2140)                                    &
         vcopt%thetav,                                    &
         isno2t,thetsn,                                   &
         iroext,0.,                                       &
         iviext,thetvi

Thanks,

William

YvanFournier commented 3 years ago

Hello,

Thanks for the bug report. This seems to be present not only in the master branch but also in versions dating at least back to v6.0. I'll push the patch tomorrow (removing the thetro output in the format).

YvanFournier commented 3 years ago

Fixed in commits f1267b79 (master) and 7fc1c9e3 (v7.0 branch).