Segmentation fault with gcc 7.2.0

294 views
Skip to first unread message

Anton Kudelin

unread,
Oct 16, 2017, 10:28:02 AM10/16/17
to cp2k

Hi all,

I'm getting following error while compiling CP2K (4.1, trunk) with gcc 7.2.0:

==19372== Memcheck, a memory error detector
==19372== Copyright (C) 2002-2017, and GNU GPL'd, by Julian Seward et al.
==19372== Using Valgrind-3.13.0 and LibVEX; rerun with -h for copyright info
==19372== Command: ./cp2k.sopt -i H2O_grad_gpw.inp -o H2O_grad_gpw.out
==19372==
At line 1015 of file cp2k-5.0/src/motion/bfgs_optimizer.F
Fortran runtime warning: An array temporary was created for argument 'r1' of procedure 'dist_second_deriv'
At line 1008 of file cp2k-5.0/src/motion/bfgs_optimizer.F
Fortran runtime warning: An array temporary was created for argument 'r1' of procedure 'dist_second_deriv'
At line 1544 of file cp2k-5.0/src/common/mathlib.F
Fortran runtime warning: An array temporary was created for argument 'a' of procedure 'diag'
At line 1544 of file cp2k-5.0/src/common/mathlib.F
Fortran runtime warning: An array temporary was created for argument 'v' of procedure 'diag'
At line 318 of file cp2k-5.0/src/atom_operators.F
Fortran runtime warning: An array temporary was created for argument 'a' of procedure 'dgesv'
At line 318 of file cp2k-5.0/src/atom_operators.F
Fortran runtime warning: An array temporary was created for argument 'b' of procedure 'dgesv'
==19372== Jump to the invalid address stated on the next line
==19372==    at 0x0: ???
==19372==    by 0x1FFEFF599F: ???
==19372==  Address 0x0 is not stack'd, malloc'd or (recently) free'd
==19372==

Program received signal SIGSEGV: Segmentation fault - invalid memory reference.

Backtrace for this error:
#0  0xbf8b91f in ???
#1  0x0 in ???
==19372==
==19372== Process terminating with default action of signal 11 (SIGSEGV): dumping core
==19372==    at 0xAFC7C1E: raise (in /usr/lib/libpthread-2.26.so)
==19372==    by 0xBF8B91F: ??? (in /usr/lib/libc-2.26.so)
==19372==
==19372== HEAP SUMMARY:
==19372==     in use at exit: 39,873,124 bytes in 121,430 blocks
==19372==   total heap usage: 770,577 allocs, 649,147 frees, 250,615,339 bytes allocated
==19372==
==19372== LEAK SUMMARY:
==19372==    definitely lost: 0 bytes in 0 blocks
==19372==    indirectly lost: 0 bytes in 0 blocks
==19372==      possibly lost: 110,304 bytes in 4 blocks
==19372==    still reachable: 39,762,820 bytes in 121,426 blocks
==19372==         suppressed: 0 bytes in 0 blocks
==19372== Rerun with --leak-check=full to see details of leaked memory
==19372==
==19372== For counts of detected and suppressed errors, rerun with: -v
==19372== ERROR SUMMARY: 1 errors from 1 contexts (suppressed: 0 from 0)

All other programs linked with libc and libpthread work well. Any ideas how to fix?

Alfio Lazzaro

unread,
Oct 17, 2017, 7:21:39 AM10/17/17
to cp2k
Hello Anton,
do I understand correctly that you are using H2O_grad_gpw.inp from the test directory:

./tests/QS/regtest-mp2-grad/H2O_grad_gpw.inp

? If so, I have compiled CP2K (trunk, sopt version) with GCC 7.2.0 and it works. 
What about if you run the sdbg version without valgrind, do you get the same error?
Please, attach your arch and inp files.

Alfio

Anton Kudelin

unread,
Oct 24, 2017, 6:53:40 AM10/24/17
to cp...@googlegroups.com
Hello, Alfio!

Yes, that's correct. The sdbg version faults the same way.

Files are attached.

Best Regads,
Anton K.
test.sopt
H2O_grad_gpw.inp
H2O_grad_gpw.inp.out
Linux-x86-64-gfortran.sdbg

Alfio Lazzaro

unread,
Oct 24, 2017, 9:04:34 AM10/24/17
to cp2k
Hello Anton,
I can't reproduce your error... 
The only difference in my arch file with respect yours is that you use MKL, while I use openblas...

I have a couple of naive suggestions, probably they are useless:

1)  I would start by including TRACE in the input file GLOBAL section, i.e.

&GLOBAL                                                                                            
 PROJECT     GRAD_H2O_gpw
 PRINT_LEVEL LOW
 RUN_TYPE    GEO_OPT
 TRACE
&END GLOBAL

In this way, you can get the last CP2K function before the crash.

2) Have you tried another GNU compiler? I wonder if it is something related to the 7.2...

3) Could you try without MKL, using openblas?

Sorry, I cannot help you more...

Alfio

Anton Kudelin

unread,
Oct 24, 2017, 10:26:19 AM10/24/17
to cp2k
It seems the "calc_screening_functions" routine causes segfault.
The use of OpenBLAS instead MKL isn't helping, switching to gcc 6 (which is in the toolchain) is resolving the problem.
One note: gcc 7.2 I use comes from the Arch Linux multilib repository.

Alfio Lazzaro

unread,
Oct 24, 2017, 10:41:25 AM10/24/17
to cp2k
OK, I see.
Well, I used the toolchain too, requiring the GCC 7.2.
These are the changes:

1) File scripts/checksums.sha256, add the line
0153a003d3b433459336a91610cca2995ee0fb3d71131bd72555f2231a6efcfc *gcc-7.2.0.tar.gz

2) File scripts/package_versions.sh, replace

6c6
< gcc_ver=${gcc_ver:-7.2.0}
---
> gcc_ver=${gcc_ver:-6.3.0}

Then you can run the toolchain script (I use ./install_cp2k_toolchain.sh --install-all)
Let's if it works...

Alfio

Anton Kudelin

unread,
Oct 25, 2017, 7:37:10 AM10/25/17
to cp2k
Dear Alfio,

I've found the point of the error. It is caused by libint linked dynamically, in the case of the static library segmentation fault is not being observed. It's a weird behaviour, but not critical. The psmp version passed all tests without errors.
Thank you very much for help!

Best Regards,
Anton K.

вторник, 24 октября 2017 г., 17:41:25 UTC+3 пользователь Alfio Lazzaro написал:
Reply all
Reply to author
Forward
0 new messages