<div dir="ltr">I have posted an update under the provisional assumption that it's gcc 11's new ipa-modref pass that is causing this code to fail, since it does seem to break some similar code.</div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Fri, Feb 18, 2022 at 11:49 AM Chris Chang <<a href="mailto:chrchang523@gmail.com">chrchang523@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-style:solid;border-left-color:rgb(204,204,204);padding-left:1ex"><div dir="ltr">What compiler version are you using? This implies that the pgl_malloc inline function is not being compiled to the expected code; there is an existing non-inlined version that is used for very old gcc versions, but it looks like it may also be needed here.</div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Fri, Feb 18, 2022 at 11:40 AM Andreas Tille <<a href="mailto:andreas@an3as.eu" target="_blank">andreas@an3as.eu</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-style:solid;border-left-color:rgb(204,204,204);padding-left:1ex">Hi again,<br>
<br>
I applied this patch and now I get:<br>
<br>
(gdb) run<br>
Starting program: /usr/lib/plink2/plink2-sse2 --debug --pfile tmp_data --export vcf vcf-dosage=DS --out tmp_data2<br>
[Thread debugging using libthread_db enabled]<br>
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".<br>
[New Thread 0x7ffff4cc7640 (LWP 4060797)]<br>
[New Thread 0x7fffec4c6640 (LWP 4060798)]<br>
[New Thread 0x7fffebcc5640 (LWP 4060799)]<br>
PLINK v2.00a3 64-bit (29 Jan 2022) <a href="http://www.cog-genomics.org/plink/2.0/" rel="noreferrer" target="_blank">www.cog-genomics.org/plink/2.0/</a><br>
(C) 2005-2022 Shaun Purcell, Christopher Chang GNU General Public License v3<br>
Logging to tmp_data2.log.<br>
Options in effect:<br>
--debug<br>
--export vcf vcf-dosage=DS<br>
--out tmp_data2<br>
--pfile tmp_data<br>
<br>
Start time: Fri Feb 18 19:06:45 2022<br>
31998 MiB RAM detected; reserving 15999 MiB for main workspace.<br>
Using up to 4 compute threads.<br>
[New Thread 0x7ffff7fc5640 (LWP 4060800)]<br>
sizeof(PhenoCol): 40 pheno_cols: 0<br>
--debug: setting pheno_cols[0].nonmiss. = nullptr<br>
<br>
Thread 1 "plink2-sse2" received signal SIGSEGV, Segmentation fault.<br>
0x00005555556fb82e in plink2::LoadPsam (psamname=psamname@entry=0x7fffffffbe70 "tmp_data.psam", pheno_range_list_ptr=<optimized out>, fam_cols=..., pheno_ct_max=<optimized out>, <br>
missing_pheno=<optimized out>, affection_01=0, max_thread_ct=4, piip=0x7fffffff8880, sample_include_ptr=0x7fffffff8790, founder_info_ptr=0x7fffffff87a8, sex_nm_ptr=0x7fffffff8798, <br>
sex_male_ptr=0x7fffffff87a0, pheno_cols_ptr=0x7fffffff8770, pheno_names_ptr=0x7fffffff8780, raw_sample_ct_ptr=0x7fffffff8728, pheno_ct_ptr=0x7fffffff8720, <br>
max_pheno_name_blen_ptr=0x7fffffff87b0) at ../plink2_psam.cc:615<br>
warning: Source file is more recent than executable.<br>
615 pheno_cols[pheno_idx].nonmiss = nullptr;<br>
<br>
Kind regards<br>
<br>
Andreas.<br>
<br>
Am Fri, Feb 18, 2022 at 08:45:12AM -0800 schrieb Chris Chang:<br>
> Ok, I don't know why that particular line would fail, but I've added<br>
> another debug-print before it on GitHub.<br>
> <br>
> On Fri, Feb 18, 2022 at 4:24 AM Andreas Tille <<a href="mailto:andreas@fam-tille.de" target="_blank">andreas@fam-tille.de</a>> wrote:<br>
> <br>
> > Hi Chris,<br>
> ><br>
> > Am Thu, Feb 17, 2022 at 07:13:49PM -0800 schrieb Chris Chang:<br>
> > > I was unable to replicate this issue on a Debian EC2 instance. However,<br>
> > > there are very few things that happen between printing "End time:" and<br>
> > > program exit, so I have added a bunch of debug-prints (active when the<br>
> > > --debug flag is passed in) to the latest GitHub commit that should reveal<br>
> > > which of those few things is triggering the segfault; let me know if you<br>
> > > are able to run this build.<br>
> ><br>
> > I think the issue is a bit more complex. Debian provides a wrapper<br>
> > which calls the best / most performant plink2. The issue seems to<br>
> > occure for SFX=avx. First I do:<br>
> ><br>
> ><br>
> > /usr/lib/plink2/plink2-avx --debug --dummy 33 65537 0.1 dosage-freq=0.1<br>
> > --out tmp_data<br>
> ><br>
> > This works. In the next step I fire up gdb then which results in<br>
> ><br>
> ><br>
> > (gdb) run<br>
> > Starting program: /usr/lib/plink2/plink2-avx --debug --pfile tmp_data<br>
> > --export vcf vcf-dosage=DS --out tmp_data2<br>
> > [Thread debugging using libthread_db enabled]<br>
> > Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".<br>
> > [New Thread 0x7ffff4cc7640 (LWP 2931408)]<br>
> > [New Thread 0x7ffff44c6640 (LWP 2931409)]<br>
> > [New Thread 0x7fffebcc5640 (LWP 2931411)]<br>
> > PLINK v2.00a3 SSE4.2 (29 Jan 2022)<br>
> > <a href="http://www.cog-genomics.org/plink/2.0/" rel="noreferrer" target="_blank">www.cog-genomics.org/plink/2.0/</a><br>
> > (C) 2005-2022 Shaun Purcell, Christopher Chang GNU General Public<br>
> > License v3<br>
> > Logging to tmp_data2.log.<br>
> > Options in effect:<br>
> > --debug<br>
> > --export vcf vcf-dosage=DS<br>
> > --out tmp_data2<br>
> > --pfile tmp_data<br>
> ><br>
> > Start time: Fri Feb 18 11:58:49 2022<br>
> > 31998 MiB RAM detected; reserving 15999 MiB for main workspace.<br>
> > Using up to 4 compute threads.<br>
> > [New Thread 0x7ffff7fc5640 (LWP 2931412)]<br>
> ><br>
> > Thread 1 "plink2-avx" received signal SIGSEGV, Segmentation fault.<br>
> > plink2::LoadPsam (psamname=psamname@entry=0x7fffffffbe70 "tmp_data.psam",<br>
> > pheno_range_list_ptr=<optimized out>, fam_cols=..., pheno_ct_max=<optimized<br>
> > out>,<br>
> > missing_pheno=<optimized out>, affection_01=0, max_thread_ct=4,<br>
> > piip=0x7fffffff8880, sample_include_ptr=0x7fffffff87a0,<br>
> > founder_info_ptr=0x7fffffff87b8, sex_nm_ptr=0x7fffffff87a8,<br>
> > sex_male_ptr=0x7fffffff87b0, pheno_cols_ptr=0x7fffffff8780,<br>
> > pheno_names_ptr=0x7fffffff8790, raw_sample_ct_ptr=0x7fffffff8738,<br>
> > pheno_ct_ptr=0x7fffffff8730,<br>
> > max_pheno_name_blen_ptr=0x7fffffff87c0) at ../plink2_psam.cc:611<br>
> > warning: Source file is more recent than executable.<br>
> > 611 pheno_cols[pheno_idx].nonmiss = nullptr;<br>
> ><br>
> ><br>
> > I also added some more debug lines in a patch[1].<br>
> ><br>
> > It seems that there is actually the weak part of the code since the<br>
> > output turns to<br>
> ><br>
> > ...<br>
> > Start time: Fri Feb 18 13:19:13 2022<br>
> > 31998 MiB RAM detected; reserving 15999 MiB for main workspace.<br>
> > Using up to 4 compute threads.<br>
> > [New Thread 0x7ffff7fc5640 (LWP 3957711)]<br>
> > --debug: setting pheno_cols[0].nonmiss. = nullptr<br>
> ><br>
> > Thread 1 "plink2-sse2" received signal SIGSEGV, Segmentation fault.<br>
> > 0x00005555556fb6ff in plink2::LoadPsam (psamname=psamname@entry=0x7fffffffbe70<br>
> > "tmp_data.psam", pheno_range_list_ptr=<optimized out>, fam_cols=...,<br>
> > pheno_ct_max=<optimized out>,<br>
> > missing_pheno=<optimized out>, affection_01=0, max_thread_ct=4,<br>
> > piip=0x7fffffff8880, sample_include_ptr=0x7fffffff87a0,<br>
> > founder_info_ptr=0x7fffffff87b8, sex_nm_ptr=0x7fffffff87a8,<br>
> > sex_male_ptr=0x7fffffff87b0, pheno_cols_ptr=0x7fffffff8780,<br>
> > pheno_names_ptr=0x7fffffff8790, raw_sample_ct_ptr=0x7fffffff8738,<br>
> > pheno_ct_ptr=0x7fffffff8730,<br>
> > max_pheno_name_blen_ptr=0x7fffffff87c0) at ../plink2_psam.cc:614<br>
> > warning: Source file is more recent than executable.<br>
> > 614 pheno_cols[pheno_idx].nonmiss = nullptr;<br>
> ><br>
> ><br>
> > I hope this might help a bit to track down the issue<br>
> ><br>
> > Andreas.<br>
> ><br>
> ><br>
> ><br>
> > [1]<br>
> > <a href="https://salsa.debian.org/med-team/plink2/-/blob/master/debian/patches/debug2.patch" rel="noreferrer" target="_blank">https://salsa.debian.org/med-team/plink2/-/blob/master/debian/patches/debug2.patch</a><br>
> ><br>
> > --<br>
> > <a href="http://fam-tille.de" rel="noreferrer" target="_blank">http://fam-tille.de</a><br>
> ><br>
<br>
-- <br>
<a href="http://fam-tille.de" rel="noreferrer" target="_blank">http://fam-tille.de</a><br>
</blockquote></div>
</blockquote></div>