mold icon indicating copy to clipboard operation
mold copied to clipboard

Simple program seg faults with Intel compiler

Open lee218llnl opened this issue 2 years ago • 6 comments
trafficstars

A user of mine has a small test program the seg faults when compiling with the Intel classic compiler (icpc) and linking with mold. It runs OK when compiled with gcc and the new Clang-based Intel compiler.

#include <stdio.h>
#include <set>

namespace MemorySpace {

  enum MemorySpace_enum : int {
   host = 1
  };

  using type = MemorySpace_enum;

  std::set<MemorySpace::type> active_memory_spaces;

}

int main()
{
   MemorySpace::active_memory_spaces.emplace(MemorySpace::host);
   printf("WORKED\n");
}

[lee218@rzwhippet17:20221212_mold]$ /usr/tce/packages/intel-classic/intel-classic-2021.6.0/bin/icpc -B/collab/usr/global/tools/mold/toss_4_x86_64_ib/mold-1.7.1-x86_64-linux/bin -o ic19molderr.exe ic19molderr.C 

[lee218@rzwhippet17:20221212_mold]$ ic19molderr.exe 
Segmentation fault (core dumped)

[lee218@rzwhippet17:20221212_mold]$ uname -a
Linux rzwhippet17 4.18.0-372.32.1.1toss.t4.x86_64 #1 SMP Tue Oct 25 15:54:22 PDT 2022 x86_64 x86_64 x86_64 GNU/Linux

lee218llnl avatar Dec 12 '22 20:12 lee218llnl

Can you rebuild your program with -Wl,--repro and share the resulting ic19molderr.exe.tar with me? That tar file will contain all input object files so that I can reproduce your issue on my machine.

rui314 avatar Dec 13 '22 02:12 rui314

the reproducer file is 95MB and Github appears to have a 25MB restriction. Do you have an email address that I can use to share a OneDrive link to the file? Otherwise you may need to download the Intel classic compiler and try yourself. Note that the compiler does not require a license.

lee218llnl avatar Dec 13 '22 19:12 lee218llnl

Is it that large after compassion? If not, please try to compress it with gzip or something.

rui314 avatar Dec 13 '22 20:12 rui314

Good idea, it was able to compress to 22MB. Please see the attached and remove the .txt extension

ic19molderr.exe.repro.tar.gz.txt

lee218llnl avatar Dec 13 '22 21:12 lee218llnl

Can you try to recompile your binary with -fuse-init-array? Does it fix the problem?

rui314 avatar Dec 14 '22 05:12 rui314

This does not appear to a valid option for the Intel compiler:

@.***:20221212_mold]$ /usr/tce/packages/intel-classic/intel-classic-2021.6.0/bin/icpc -B/collab/usr/global/tools/mold/toss_4_x86_64_ib/mold-1.7.1-x86_64-linux/bin -o ic19molderr.exe ic19molderr.C -fuse-init-array icpc: command line warning #10148: option '-fuse-init-array' not supported


From: Rui Ueyama @.> Sent: Tuesday, December 13, 2022 9:50 PM To: rui314/mold @.> Cc: Lee, Greg @.>; Author @.> Subject: Re: [rui314/mold] Simple program seg faults with Intel compiler (Issue #914)

Can you try to recompile your binary with -fuse-init-array? Does it fix the problem?

— Reply to this email directly, view it on GitHubhttps://urldefense.us/v3/__https://github.com/rui314/mold/issues/914*issuecomment-1350433271__;Iw!!G2kpM7uM-TzIFchu!n0DOAel2fT0I1AsWSyY41-6hEW1thlox3b8Pqo9TTQZnoqH2nJW8FCwb4FuZFmwriA$, or unsubscribehttps://urldefense.us/v3/__https://github.com/notifications/unsubscribe-auth/AA3ZFC4N3P7GSXORC7CQGYLWNFNZTANCNFSM6AAAAAAS4MOQTE__;!!G2kpM7uM-TzIFchu!n0DOAel2fT0I1AsWSyY41-6hEW1thlox3b8Pqo9TTQZnoqH2nJW8FCwb4FvO01TEEg$. You are receiving this because you authored the thread.Message ID: @.***>

lee218llnl avatar Dec 14 '22 15:12 lee218llnl