[med-svn] [Git][med-team/plink2][upstream] New upstream version 2.00~a3-220217+dfsg

Andreas Tille (@tille) gitlab at salsa.debian.org
Sat Feb 19 11:19:00 GMT 2022



Andreas Tille pushed to branch upstream at Debian Med / plink2


Commits:
16f76ff3 by Andreas Tille at 2022-02-19T11:40:29+01:00
New upstream version 2.00~a3-220217+dfsg
- - - - -


5 changed files:

- plink2.cc
- plink2_cmdline.cc
- plink2_matrix.cc
- plink2_merge.cc
- plink2_psam.cc


Changes:

=====================================
plink2.cc
=====================================
@@ -71,7 +71,7 @@ static const char ver_str[] = "PLINK v2.00a3"
 #ifdef USE_MKL
   " Intel"
 #endif
-  " (29 Jan 2022)";
+  " (17 Feb 2022)";
 static const char ver_str2[] =
   // include leading space if day < 10, so character length stays the same
   ""
@@ -10944,7 +10944,13 @@ int main(int argc, char** argv) {
     reterr = kPglRetWriteFail;
   }
   if (bigstack_ua) {
+    if (g_debug_on) {
+      fputs("--debug: Trying to free bigstack_ua.\n", stdout);
+    }
     free(bigstack_ua);
   }
+  if (g_debug_on) {
+    fputs("--debug: Exiting.\n", stdout);
+  }
   return S_CAST(int32_t, reterr);
 }


=====================================
plink2_cmdline.cc
=====================================
@@ -526,9 +526,15 @@ BoolErr CleanupLogfile(uint32_t print_end_time) {
   }
   BoolErr ret_boolerr = 0;
   if (g_logfile) {
+    if (g_debug_on) {
+      printf("--debug: g_log_failed = %u.\n", g_log_failed);
+    }
     if (!g_log_failed) {
       logputs_silent("\n");
       logputs_silent(g_logbuf);
+      if (g_debug_on) {
+        fputs("--debug: Trying to close log.\n", stdout);
+      }
       if (unlikely(fclose(g_logfile))) {
         fflush(stdout);
         fprintf(stderr, "Error: Failed to finish writing to log: %s.\n", strerror(errno));
@@ -3571,6 +3577,12 @@ PglErr CmdlineParsePhase1(const char* ver_str, const char* ver_str2, const char*
   PglErr reterr = kPglRetSuccess;
   {
     int argc = *argc_ptr;
+    if (argc < 1) {
+      fputs(ver_str, stdout);
+      fputs(ver_str2, stdout);
+      fputs("Error: This application must be invoked with positive argc.\n", stderr);
+      goto CmdlineParsePhase1_ret_INVALID_CMDLINE;
+    }
     const char* const* argvk = TO_CONSTCPCONSTP(*argv_ptr);
     char** subst_argv = nullptr;
     uint32_t first_arg_idx = 1;


=====================================
plink2_matrix.cc
=====================================
@@ -234,7 +234,7 @@ static inline double MultiplyBySgn(double aa, double bb) {
 uint32_t SvdcmpC(int32_t m, double* a, double* w, double* v) {
   // C port of PLINK stats.cpp svdcmp().
   // Now thread-safe.
-  double* rv1 = &(w[(uint32_t)m]);
+  double* rv1 = &(w[S_CAST(uint32_t, m)]);
   int32_t n = m;
   int32_t flag;
   int32_t l = 0;  // suppress compile warning
@@ -474,12 +474,12 @@ BoolErr InvertMatrix(int32_t dim, double* matrix, MatrixInvertBuf1* dbl_1d_buf,
 BoolErr InvertFmatrixFirstHalf(int32_t dim, uint32_t stride, const float* matrix, double* half_inverted, MatrixInvertBuf1* dbl_1d_buf, double* dbl_2d_buf) {
   const float* read_row = matrix;
   double* write_row = half_inverted;
-  for (uint32_t row_idx = 0; row_idx != (uint32_t)dim; ++row_idx) {
-    for (uint32_t col_idx = 0; col_idx != (uint32_t)dim; ++col_idx) {
-      write_row[col_idx] = (double)read_row[col_idx];
+  for (uint32_t row_idx = 0; row_idx != S_CAST(uint32_t, dim); ++row_idx) {
+    for (uint32_t col_idx = 0; col_idx != S_CAST(uint32_t, dim); ++col_idx) {
+      write_row[col_idx] = S_CAST(double, read_row[col_idx]);
     }
     read_row = &(read_row[stride]);
-    write_row = &(write_row[(uint32_t)dim]);
+    write_row = &(write_row[S_CAST(uint32_t, dim)]);
   }
 
   return (!SvdcmpC(dim, half_inverted, dbl_1d_buf, dbl_2d_buf));


=====================================
plink2_merge.cc
=====================================
@@ -2886,7 +2886,8 @@ PglErr ScanPvarsAndMergeHeader(const PmergeInfo* pmip, MiscFlags misc_flags, uin
     //    depending on --sort-vars setting.
     // See also SortChr() in plink2_data.cc.  This is a bit simpler since we
     // don't need the sort_idxs to be dense.
-    const uint32_t chr_code_end = cip->max_code + 1 + name_ct;
+    const uint32_t max_code_p1 = cip->max_code + 1;
+    const uint32_t chr_code_end = max_code_p1 + name_ct;
     uint32_t* chr_idx_to_sort_idx;
     if (unlikely(bigstack_end_alloc_u32(chr_code_end, &chr_idx_to_sort_idx))) {
       goto ScanPvarsAndMergeHeader_ret_NOMEM;
@@ -2907,12 +2908,13 @@ PglErr ScanPvarsAndMergeHeader(const PmergeInfo* pmip, MiscFlags misc_flags, uin
       }
       const char** nonstd_names = cip->nonstd_names;
       for (uint32_t name_idx = 0; name_idx != name_ct; ++name_idx) {
-        nonstd_sort_buf[name_idx].strptr = nonstd_names[name_idx];
+        // bugfix (17 Feb 2022): first non-null nonstd_names[] entry is at
+        // [max_code_p1], not [0]
+        nonstd_sort_buf[name_idx].strptr = nonstd_names[name_idx + max_code_p1];
         nonstd_sort_buf[name_idx].orig_idx = name_idx;
       }
       // nonstd_names are not allocated in main workspace, so can't overread.
       StrptrArrSortMain(name_ct, 0, (sort_vars_mode != kSortAscii), nonstd_sort_buf);
-      const uint32_t max_code_p1 = cip->max_code + 1;
       for (uint32_t name_idx = 0; name_idx != name_ct; ++name_idx) {
         chr_idx_to_sort_idx[max_code_p1 + nonstd_sort_buf[name_idx].orig_idx] = name_code_start + name_idx;
       }


=====================================
plink2_psam.cc
=====================================
@@ -1252,7 +1252,7 @@ PglErr LoadPhenos(const char* pheno_fname, const RangeList* pheno_range_list_ptr
         goto LoadPhenos_ret_MALFORMED_INPUT_WW;
       }
       SetBit(first_sample_uidx, already_seen);
-      if (unlikely(S_CAST(uintptr_t, tmp_bigstack_end - bigstack_base_copy) < pheno_info_alloc_byte_ct) * (xid_idx_end - xid_idx_start)) {
+      if (unlikely(S_CAST(uintptr_t, tmp_bigstack_end - bigstack_base_copy) < (pheno_info_alloc_byte_ct * (xid_idx_end - xid_idx_start)))) {
         goto LoadPhenos_ret_NOMEM;
       }
       tmp_bigstack_end -= pheno_info_alloc_byte_ct;



View it on GitLab: https://salsa.debian.org/med-team/plink2/-/commit/16f76ff3c979f6cbac0c68b2937c6ff40f6d666f

-- 
View it on GitLab: https://salsa.debian.org/med-team/plink2/-/commit/16f76ff3c979f6cbac0c68b2937c6ff40f6d666f
You're receiving this email because of your account on salsa.debian.org.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://alioth-lists.debian.net/pipermail/debian-med-commit/attachments/20220219/4bfdf55b/attachment-0001.htm>


More information about the debian-med-commit mailing list