Package: phyml / 3:3.3.20220408-4

fix_wrong_initialisation_of_array.patch Patch series | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
Author: Andreas Tille <tille@debian.org>
        Thomas Schmitt <scdbackup@gmx.net>
Last-Update: 2017-06-24
Description: avoid initialisation an array with a scalar value
 Quoting James Cowgill <jcowgill@debian.org> on debian-mentors list:
 .
 You can't initialize an array with a scalar value (double[] != double).
 Also, using an array of fixed size 1 is a code smell (why use an array
 at all?)
 .
 The quick fix here is probably to wrap the values in curly braces to
 form a correct array initializer.

--- phyml.orig/src/lk.c
+++ phyml/src/lk.c
@@ -2268,8 +2268,8 @@
       
       //
       len = MAX(0.0, b_fcus->l->v) * tree->mod->br_len_mult->v;
-      int p_matrices[1]     = b_fcus->Pij_rr_idx;
-      double branch_lens[1] = len;
+      int p_matrices[1]     = { b_fcus->Pij_rr_idx };
+      double branch_lens[1] = { len };
       int ret = beagleUpdateTransitionMatrices(tree->b_inst,0,p_matrices,NULL,NULL,branch_lens,1);
       if(ret<0)
         {