MethodicalAcceleratorDesign / MAD-NG

MAD Next-Generation official repository
GNU General Public License v3.0
32 stars 11 forks source link

Junk in tpsa #443

Closed mattsignorelli closed 5 months ago

mattsignorelli commented 5 months ago

this is compiled with TPSA_STRICT=1

Using a GTPSA descriptor with NV=4, MO=5

The result for mono([0]) + mono([5]) (equivalent in FPP 1.0_dp.mono.'0000' + 1.0_dp.mono.'5000') contains junk

Here I call mad_tpsa_print directly from Julia REPL (though the junk also appears in cycle):

julia> t = mono([0])+mono([5]);
-> mad_tpsa_newd:277:
<- mad_tpsa_newd:281:
-> mad_tpsa_setm:713:
-> mad_desc_idxm:1166:
<- mad_desc_idxm:1169:
-> mad_tpsa_seti:675:
<- mad_tpsa_seti:676:
<- mad_tpsa_setm:717:
-> mad_tpsa_newd:277:
<- mad_tpsa_newd:281:
-> mad_tpsa_setm:713:
-> mad_desc_idxm:1166:
<- mad_desc_idxm:1169:
-> mad_tpsa_seti:675:
<- mad_tpsa_seti:697:
<- mad_tpsa_setm:717:
-> mad_tpsa_newd:277:
<- mad_tpsa_newd:281:
-> mad_tpsa_add:340:
-> mad_tpsa_update:312:
<- mad_tpsa_update:315:
<- mad_tpsa_add:349:

julia> @ccall GTPSA.MAD_TPSA.mad_tpsa_print(t.tpsa::Ptr{GTPSA.RTPSA}, ""::Cstring, 0.::Cdouble, 0::Cint, C_NULL::Ptr{Cvoid})::Cvoid
-> mad_tpsa_print:394:

         :  R, NV =   4, MO =  5
 *******************************************************
     I   COEFFICIENT             ORDER   EXPONENTS
     1   1.0000000000000000E+00    0     0 0  0 0
     2  5.1392432625874638E+151    1     1 0  0 0
     3  2.8923160390046967E+150    1     0 1  0 0
     4  5.4893798940959826E+247    1     0 0  1 0
     5   1.7248052122260272E+88    1     0 0  0 1
     6  2.2136652626937830E+214    2     2 0  0 0
     7  6.3491339777490580E+151    2     1 1  0 0
     8  2.8923160390046967E+150    2     0 2  0 0
     9  2.9750455713318639E+228    2     1 0  1 0
    10   6.0993254904428441E+06    2     0 1  1 0
    11  4.0689292158635157E+233    2     0 0  2 0
    12  7.4908870546729441E+247    2     1 0  0 1
    13   6.0993254904407114E+06    2     0 1  0 1
    14  4.0689292158635157E+233    2     0 0  1 1
    15  7.4951120336428874E+247    2     0 0  0 2
    16   2.0900229399743304E-95    3     3 0  0 0
    17  3.8394470233569706E+151    3     2 1  0 0
    18  5.3378822297671867E+223    3     1 2  0 0
    19   2.0900229399743304E-95    3     0 3  0 0
    20  3.8394470233569706E+151    3     2 0  1 0
    21  4.2291060078199836E+252    3     1 1  1 0
    22  4.7358351275887197E+170    3     0 2  1 0
    23  2.3614624986430928E+257    3     1 0  2 0
    24   2.6804609146917965E+98    3     0 1  2 0
    25  7.8008777494712378E+194    3     0 0  3 0
    26  2.5693006768828409E+151    3     2 0  0 1
    27  2.5510308815662372E+151    3     1 1  0 1
    28  6.7868364896750914E+199    3     0 2  0 1
    29  2.4164316503799239E-314    3     1 0  1 1
    30  2.4165545951574319E-314    3     0 1  1 1
    31  8.8931816251424378E-323    3     0 0  2 1
    32  2.4162780760027019E-314    3     1 0  0 2
    33   2.0000000000000000E+00    3     0 1  0 2
    34   0.0000000000000000E+00    3     0 0  1 2
    35  2.1507607889080581E-314    3     0 0  0 3
    36   0.0000000000000000E+00    4     4 0  0 0
    37  2.4165545872523816E-314    4     3 1  0 0
    38  7.4109846876186982E-323    4     2 2  0 0
    39  2.4162781036703780E-314    4     1 3  0 0
    40   2.0000000000000000E+00    4     0 4  0 0
    41   0.0000000000000000E+00    4     3 0  1 0
    42  2.1506462980878160E-314    4     2 1  1 0
    43                      NAN    4     1 2  1 0
    44  2.4403226818333041E-314    4     0 3  1 0
    45  1.0375378562666177E-322    4     2 0  2 0
    46  5.2150171589803887E-310    4     1 1  2 0
    47  2.4403226818333041E-314    4     0 2  2 0
    48  1.2450454275199413E-321    4     1 0  3 0
    49  5.2150182530464694E-310    4     0 1  3 0
    50  5.2150182530464694E-310    4     0 0  4 0
    51  5.2150182530591175E-310    4     3 0  0 1
    52  2.4165546139319265E-314    4     2 1  0 1
    53  5.9287877500949585E-323    4     1 2  0 1
    54  2.4162781115754284E-314    4     0 3  0 1
    55  -2.0000000000000000E+00    4     2 0  1 1
    56  1.2450454275199413E-321    4     1 1  1 1
    57  2.4165546292479615E-314    4     0 2  1 1
    58  2.4703282292062327E-323    4     1 0  2 1
    59  2.4162781115754284E-314    4     0 1  2 1
    60  -1.4916681462400413E-154    4     0 0  3 1
    61  1.2450454275199413E-321    4     2 0  0 2
    62  2.4403228063378469E-314    4     1 1  0 2
    63  1.0375378562666177E-322    4     0 2  0 2
    64  5.2150171589803887E-310    4     1 0  1 2
    65  2.4403228063378469E-314    4     0 1  1 2
    66  3.5572726500569751E-322    4     0 0  2 2
    67  5.2150173101447137E-310    4     1 0  0 3
    68  5.2150173101447137E-310    4     0 1  0 3
    69  5.2150173101510377E-310    4     0 0  1 3
    70  2.4165546045446792E-314    4     0 0  0 4
    71   1.0000000000000000E+00    5     5 0  0 0
    72   0.0000000000000000E+00    5     4 1  0 0
    73   0.0000000000000000E+00    5     3 2  0 0
    74   0.0000000000000000E+00    5     2 3  0 0
    75   0.0000000000000000E+00    5     1 4  0 0
    76   0.0000000000000000E+00    5     0 5  0 0
    77   0.0000000000000000E+00    5     4 0  1 0
    78   0.0000000000000000E+00    5     3 1  1 0
    79   0.0000000000000000E+00    5     2 2  1 0
    80   0.0000000000000000E+00    5     1 3  1 0
    81   0.0000000000000000E+00    5     0 4  1 0
    82   0.0000000000000000E+00    5     3 0  2 0
    83   0.0000000000000000E+00    5     2 1  2 0
    84   0.0000000000000000E+00    5     1 2  2 0
    85   0.0000000000000000E+00    5     0 3  2 0
    86   0.0000000000000000E+00    5     2 0  3 0
    87   0.0000000000000000E+00    5     1 1  3 0
    88   0.0000000000000000E+00    5     0 2  3 0
    89   0.0000000000000000E+00    5     1 0  4 0
    90   0.0000000000000000E+00    5     0 1  4 0
    91   0.0000000000000000E+00    5     0 0  5 0
    92   0.0000000000000000E+00    5     4 0  0 1
    93   0.0000000000000000E+00    5     3 1  0 1
    94   0.0000000000000000E+00    5     2 2  0 1
    95   0.0000000000000000E+00    5     1 3  0 1
    96   0.0000000000000000E+00    5     0 4  0 1
    97   0.0000000000000000E+00    5     3 0  1 1
    98   0.0000000000000000E+00    5     2 1  1 1
    99   0.0000000000000000E+00    5     1 2  1 1
   100   0.0000000000000000E+00    5     0 3  1 1
   101   0.0000000000000000E+00    5     2 0  2 1
   102   0.0000000000000000E+00    5     1 1  2 1
   103   0.0000000000000000E+00    5     0 2  2 1
   104   0.0000000000000000E+00    5     1 0  3 1
   105   0.0000000000000000E+00    5     0 1  3 1
   106   0.0000000000000000E+00    5     0 0  4 1
   107   0.0000000000000000E+00    5     3 0  0 2
   108   0.0000000000000000E+00    5     2 1  0 2
   109   0.0000000000000000E+00    5     1 2  0 2
   110   0.0000000000000000E+00    5     0 3  0 2
   111   0.0000000000000000E+00    5     2 0  1 2
   112   0.0000000000000000E+00    5     1 1  1 2
   113   0.0000000000000000E+00    5     0 2  1 2
   114   0.0000000000000000E+00    5     1 0  2 2
   115   0.0000000000000000E+00    5     0 1  2 2
   116   0.0000000000000000E+00    5     0 0  3 2
   117   0.0000000000000000E+00    5     2 0  0 3
   118   0.0000000000000000E+00    5     1 1  0 3
   119   0.0000000000000000E+00    5     0 2  0 3
   120   0.0000000000000000E+00    5     1 0  1 3
   121   0.0000000000000000E+00    5     0 1  1 3
   122   0.0000000000000000E+00    5     0 0  2 3
   123   0.0000000000000000E+00    5     1 0  0 4
   124   0.0000000000000000E+00    5     0 1  0 4
   125   0.0000000000000000E+00    5     0 0  1 4
   126   0.0000000000000000E+00    5     0 0  0 5
<- mad_tpsa_print:441:
mattsignorelli commented 5 months ago

I am also getting a heap corruption or abort trap: 6 randomly when running a lot of code with GTPSAs

mattsignorelli commented 5 months ago

The junk appears to enter on line 291 of mad_tpsa_ops.c: https://github.com/MethodicalAcceleratorDesign/MAD-NG/blob/9a5d7708a8f8f43a0b7415eb20ccfa863ad754dc/src/mad_tpsa_ops.c#L291

Once the c->hi is set, all the higher order monomials have junk coefficients instead of 0 as shown in mad_tpsa_print or mad_tpsa_cycle and it stays that way after the entire call to add

mattsignorelli commented 5 months ago

It also appears dependent on the computer I'm on. For a very small Ubuntu virtual machine (4GB), I only need NV=1 for the junk to appear. On my work Mac, I need NV=4

mattsignorelli commented 5 months ago

OK I've got a C example

Compile this with -fsanitize=address -g:

#include "mad_tpsa.h"

enum { NV = 1,
       MO = 10, 
};

int main(void)
{
  const desc_t *d = mad_desc_newv(NV, MO);

  tpsa_t* x = mad_tpsa_newd(d, 255);
  tpsa_t* y = mad_tpsa_newd(d, 255);
  tpsa_t* z = mad_tpsa_newd(d, 255);

  mad_tpsa_seti(x, 0, 0.,1.);
  mad_tpsa_seti(y, MO, 0.,1.);
  mad_tpsa_add(x, y, z);

  mad_tpsa_print(z, "", 0, 0, 0);

  mad_tpsa_del(x);
  mad_tpsa_del(y);
  mad_tpsa_del(z);
  mad_desc_del(0);
  return 0;
}

print as well as cycle show a bunch of junk in the tpsa

ldeniau commented 5 months ago

Apparently, libasan is not supported with gcc on Mac anymore, are you running llvm? And unfortunately I don't have the problem you are reporting above without libasan, even with NV=4 or 6. I put below the output with STRICT=1, dbga=3 (to check TPSA on input and the TPSA on output even if it is valid), and I uncommented the extra print debug in axpbypc. I don't see any wrong (lo,hi) pairs. https://github.com/iains/gcc-darwin-arm64/blob/294ce24053d0552ea4a1af9a60fe66b1cde56413/libsanitizer/configure.tgt#L68

-> mad_tpsa_newd:277:
mad_tpsa_newd:281: 'r' { lo=1 hi=0 mo=10(255) ao=10 uid=0 did=0 r=1.00 } 0x0x7ff4001a0008
-> mad_tpsa_print:394:

 r       :  R, NV =   6, MO = 10
 *******************************************************

         ALL COMPONENTS ZERO (EPS=1.0E-40)
<- mad_tpsa_print:441:
<- mad_tpsa_newd:281:
-> mad_tpsa_newd:277:
mad_tpsa_newd:281: 'r' { lo=1 hi=0 mo=10(255) ao=10 uid=0 did=0 r=1.00 } 0x0x7ff4001b0008
-> mad_tpsa_print:394:

 r       :  R, NV =   6, MO = 10
 *******************************************************

         ALL COMPONENTS ZERO (EPS=1.0E-40)
<- mad_tpsa_print:441:
<- mad_tpsa_newd:281:
-> mad_tpsa_newd:277:
mad_tpsa_newd:281: 'r' { lo=1 hi=0 mo=10(255) ao=10 uid=0 did=0 r=1.00 } 0x0x7ff4001c0008
-> mad_tpsa_print:394:

 r       :  R, NV =   6, MO = 10
 *******************************************************

         ALL COMPONENTS ZERO (EPS=1.0E-40)
<- mad_tpsa_print:441:
<- mad_tpsa_newd:281:
-> mad_tpsa_seti:676:
<- mad_tpsa_seti:677:
-> mad_tpsa_seti:676:
mad_tpsa_seti:698: 't' { lo=2 hi=2 mo=10(255) ao=10 uid=0 did=0 r=0.05 } 0x0x7ff4001b0008
-> mad_tpsa_print:394:

 t       :  R, NV =   6, MO = 10
 *******************************************************
     I   COEFFICIENT             ORDER   EXPONENTS
     1   1.0000000000000000E+00    2     1 0  1 0  0 0
<- mad_tpsa_print:441:
<- mad_tpsa_seti:698:
-> mad_tpsa_add:340:
alo=1[1], ahi=0[0], blo=2[2], bhi=2[2], clo=1, chi=2
c1=1.0000e+00, c2=1.0000e+00, c3=0.0000e+00
aaa=0x0x7fd4701a0008, bbb=0x0x7fd4701b0008, ccc=0x0x7fd4701c0008
-> mad_tpsa_print:394:

 aaa     :  R, NV =   6, MO = 10
 *******************************************************
     I   COEFFICIENT             ORDER   EXPONENTS
     1   1.0000000000000000E+00    0     0 0  0 0  0 0
<- mad_tpsa_print:441:
-> mad_tpsa_print:394:

 bbb     :  R, NV =   6, MO = 10
 *******************************************************
     I   COEFFICIENT             ORDER   EXPONENTS
     1   0.0000000000000000E+00    0     0 0  0 0  0 0
     2   0.0000000000000000E+00    2     2 0  0 0  0 0
     3   0.0000000000000000E+00    2     1 1  0 0  0 0
     4   0.0000000000000000E+00    2     0 2  0 0  0 0
     5   1.0000000000000000E+00    2     1 0  1 0  0 0
     6   0.0000000000000000E+00    2     0 1  1 0  0 0
     7   0.0000000000000000E+00    2     0 0  2 0  0 0
     8   0.0000000000000000E+00    2     1 0  0 1  0 0
     9   0.0000000000000000E+00    2     0 1  0 1  0 0
    10   0.0000000000000000E+00    2     0 0  1 1  0 0
    11   0.0000000000000000E+00    2     0 0  0 2  0 0
    12   0.0000000000000000E+00    2     1 0  0 0  1 0
    13   0.0000000000000000E+00    2     0 1  0 0  1 0
    14   0.0000000000000000E+00    2     0 0  1 0  1 0
    15   0.0000000000000000E+00    2     0 0  0 1  1 0
    16   0.0000000000000000E+00    2     0 0  0 0  2 0
    17   0.0000000000000000E+00    2     1 0  0 0  0 1
    18   0.0000000000000000E+00    2     0 1  0 0  0 1
    19   0.0000000000000000E+00    2     0 0  1 0  0 1
    20   0.0000000000000000E+00    2     0 0  0 1  0 1
    21   0.0000000000000000E+00    2     0 0  0 0  1 1
    22   0.0000000000000000E+00    2     0 0  0 0  0 2
<- mad_tpsa_print:441:
-> mad_tpsa_print:394:

 ccc     :  R, NV =   6, MO = 10
 *******************************************************
     I   COEFFICIENT             ORDER   EXPONENTS
     1   1.0000000000000000E+00    0     0 0  0 0  0 0
     2   0.0000000000000000E+00    1     1 0  0 0  0 0
     3   0.0000000000000000E+00    1     0 1  0 0  0 0
     4   0.0000000000000000E+00    1     0 0  1 0  0 0
     5   0.0000000000000000E+00    1     0 0  0 1  0 0
     6   0.0000000000000000E+00    1     0 0  0 0  1 0
     7   0.0000000000000000E+00    1     0 0  0 0  0 1
     8   0.0000000000000000E+00    2     2 0  0 0  0 0
     9   0.0000000000000000E+00    2     1 1  0 0  0 0
    10   0.0000000000000000E+00    2     0 2  0 0  0 0
    11   1.0000000000000000E+00    2     1 0  1 0  0 0
    12   0.0000000000000000E+00    2     0 1  1 0  0 0
    13   0.0000000000000000E+00    2     0 0  2 0  0 0
    14   0.0000000000000000E+00    2     1 0  0 1  0 0
    15   0.0000000000000000E+00    2     0 1  0 1  0 0
    16   0.0000000000000000E+00    2     0 0  1 1  0 0
    17   0.0000000000000000E+00    2     0 0  0 2  0 0
    18   0.0000000000000000E+00    2     1 0  0 0  1 0
    19   0.0000000000000000E+00    2     0 1  0 0  1 0
    20   0.0000000000000000E+00    2     0 0  1 0  1 0
    21   0.0000000000000000E+00    2     0 0  0 1  1 0
    22   0.0000000000000000E+00    2     0 0  0 0  2 0
    23   0.0000000000000000E+00    2     1 0  0 0  0 1
    24   0.0000000000000000E+00    2     0 1  0 0  0 1
    25   0.0000000000000000E+00    2     0 0  1 0  0 1
    26   0.0000000000000000E+00    2     0 0  0 1  0 1
    27   0.0000000000000000E+00    2     0 0  0 0  1 1
    28   0.0000000000000000E+00    2     0 0  0 0  0 2
<- mad_tpsa_print:441:
axpbypc:313: 'a' { lo=1 hi=0 mo=10(255) ao=10 uid=0 did=0 r=1.00 } 0x0x7fd4701a0008
-> mad_tpsa_print:394:

 a       :  R, NV =   6, MO = 10
 *******************************************************
     I   COEFFICIENT             ORDER   EXPONENTS
     1   1.0000000000000000E+00    0     0 0  0 0  0 0
<- mad_tpsa_print:441:
axpbypc:314: 'b' { lo=2 hi=2 mo=10(255) ao=10 uid=0 did=0 r=0.05 } 0x0x7fd4701b0008
-> mad_tpsa_print:394:

 b       :  R, NV =   6, MO = 10
 *******************************************************
     I   COEFFICIENT             ORDER   EXPONENTS
     1   1.0000000000000000E+00    2     1 0  1 0  0 0
<- mad_tpsa_print:441:
-> mad_tpsa_update:312:
mad_tpsa_update:315: 't' { lo=2 hi=2 mo=10(255) ao=10 uid=0 did=0 r=0.05 } 0x0x7fd4701c0008
-> mad_tpsa_print:394:

 t       :  R, NV =   6, MO = 10
 *******************************************************
     I   COEFFICIENT             ORDER   EXPONENTS
     1   1.0000000000000000E+00    0     0 0  0 0  0 0
     2   1.0000000000000000E+00    2     1 0  1 0  0 0
<- mad_tpsa_print:441:
<- mad_tpsa_update:315:
<- mad_tpsa_add:349:
-> mad_tpsa_print:394:

 y       :  R, NV =   6, MO = 10
 *******************************************************
     I   COEFFICIENT             ORDER   EXPONENTS
     1   1.0000000000000000E+00    0     0 0  0 0  0 0
<- mad_tpsa_print:441:
-> mad_tpsa_print:394:

 x       :  R, NV =   6, MO = 10
 *******************************************************
     I   COEFFICIENT             ORDER   EXPONENTS
     1   0.0000000000000000E+00    0     0 0  0 0  0 0
     2   0.0000000000000000E+00    2     2 0  0 0  0 0
     3   0.0000000000000000E+00    2     1 1  0 0  0 0
     4   0.0000000000000000E+00    2     0 2  0 0  0 0
     5   1.0000000000000000E+00    2     1 0  1 0  0 0
     6   0.0000000000000000E+00    2     0 1  1 0  0 0
     7   0.0000000000000000E+00    2     0 0  2 0  0 0
     8   0.0000000000000000E+00    2     1 0  0 1  0 0
     9   0.0000000000000000E+00    2     0 1  0 1  0 0
    10   0.0000000000000000E+00    2     0 0  1 1  0 0
    11   0.0000000000000000E+00    2     0 0  0 2  0 0
    12   0.0000000000000000E+00    2     1 0  0 0  1 0
    13   0.0000000000000000E+00    2     0 1  0 0  1 0
    14   0.0000000000000000E+00    2     0 0  1 0  1 0
    15   0.0000000000000000E+00    2     0 0  0 1  1 0
    16   0.0000000000000000E+00    2     0 0  0 0  2 0
    17   0.0000000000000000E+00    2     1 0  0 0  0 1
    18   0.0000000000000000E+00    2     0 1  0 0  0 1
    19   0.0000000000000000E+00    2     0 0  1 0  0 1
    20   0.0000000000000000E+00    2     0 0  0 1  0 1
    21   0.0000000000000000E+00    2     0 0  0 0  1 1
    22   0.0000000000000000E+00    2     0 0  0 0  0 2
<- mad_tpsa_print:441:
-> mad_tpsa_print:394:

 z       :  R, NV =   6, MO = 10
 *******************************************************
     I   COEFFICIENT             ORDER   EXPONENTS
     1   1.0000000000000000E+00    0     0 0  0 0  0 0
     2   0.0000000000000000E+00    2     2 0  0 0  0 0
     3   0.0000000000000000E+00    2     1 1  0 0  0 0
     4   0.0000000000000000E+00    2     0 2  0 0  0 0
     5   1.0000000000000000E+00    2     1 0  1 0  0 0
     6   0.0000000000000000E+00    2     0 1  1 0  0 0
     7   0.0000000000000000E+00    2     0 0  2 0  0 0
     8   0.0000000000000000E+00    2     1 0  0 1  0 0
     9   0.0000000000000000E+00    2     0 1  0 1  0 0
    10   0.0000000000000000E+00    2     0 0  1 1  0 0
    11   0.0000000000000000E+00    2     0 0  0 2  0 0
    12   0.0000000000000000E+00    2     1 0  0 0  1 0
    13   0.0000000000000000E+00    2     0 1  0 0  1 0
    14   0.0000000000000000E+00    2     0 0  1 0  1 0
    15   0.0000000000000000E+00    2     0 0  0 1  1 0
    16   0.0000000000000000E+00    2     0 0  0 0  2 0
    17   0.0000000000000000E+00    2     1 0  0 0  0 1
    18   0.0000000000000000E+00    2     0 1  0 0  0 1
    19   0.0000000000000000E+00    2     0 0  1 0  0 1
    20   0.0000000000000000E+00    2     0 0  0 1  0 1
    21   0.0000000000000000E+00    2     0 0  0 0  1 1
    22   0.0000000000000000E+00    2     0 0  0 0  0 2
<- mad_tpsa_print:441:
-> mad_tpsa_del:294:
<- mad_tpsa_del:296:
-> mad_tpsa_del:294:
<- mad_tpsa_del:296:
-> mad_tpsa_del:294:
<- mad_tpsa_del:296:
-> mad_desc_del:1328:
<- mad_desc_del:1378:
mattsignorelli commented 5 months ago

I compile GTPSA to a shared library with GCC. The bug first appeared when calling the shared library from Julia (initially had trouble getting a pure C example, even with the exact same code: https://github.com/bmad-sim/GTPSA.jl/issues/109 ) , but I was finally able to see the bug in the above C code when compiling with the address sanitizer on Linux. I could not get the bug to appear in pure C without the address sanitizer

ldeniau commented 5 months ago

fixed in #c2a0cf55 The bug was in the setup of lo (not hi) when one of the two input tpsa is a scalar and its coefficient is not zero... Thanks for pointing out this particular case which wasn't occurring in Tracking + NF + RDTs calculations, proving once more that nothing replace proper test suites...

mattsignorelli commented 5 months ago

Now for the same code, I get an error with or without the address sanitizer. This is compiled with TPSA_STRICT=1, TPSA_DEBUG=3, and each of mad_tpsa_dbgo, dbgf, and dbga set to 3.

I also see the bug when instead setting the 1st order part of x to 1 instead of the scalar part.

The code

#include "mad_tpsa.h"

enum { NV = 1,
       MO = 10, 
};

int main(void)
{
  const desc_t *d = mad_desc_newv(NV, MO);

  tpsa_t* x = mad_tpsa_newd(d, mad_tpsa_dflt);
  tpsa_t* y = mad_tpsa_newd(d, mad_tpsa_dflt);
  tpsa_t* z = mad_tpsa_newd(d, mad_tpsa_dflt);

  mad_tpsa_seti(x, 1, 0., 1.);  // or mad_tpsa_seti(x, 0, 0.,1.);  
  mad_tpsa_seti(y, MO, 0.,1.);
  mad_tpsa_add(x, y, z);

  mad_tpsa_print(z, "", 0, 0, 0);

  mad_tpsa_del(x);
  mad_tpsa_del(y);
  mad_tpsa_del(z);
  mad_desc_del(0);
  return 0;
}

The output without address sanitizing (excluding the -> and <-):

mad_tpsa_newd:281: 'r' { lo=1 hi=0 mo=10(3) ao=10 uid=0 did=0 ** bug @ o=0 } 0x0x55fbb9e74ee8
 [0:0]=+0.0000E+00
 [1:1]=+0.0000E+00
 [2:2]=+0.0000E+00
 [3:3]=+0.0000E+00
 [4:4]=+0.0000E+00
 [5:5]=+0.0000E+00
 [6:6]=+0.0000E+00
 [7:7]=+0.0000E+00
 [8:8]=+0.0000E+00
 [9:9]=+0.0000E+00
 [10:10]=+0.0000E+00

error: /home/matt/tpsa/gtpsa/code/mad_tpsa.c:139: : /home/matt/tpsa/gtpsa/code/mad_tpsa.c:139:

The output with -fsanitize=address

mad_tpsa_newd:281: 'r' { lo=1 hi=0 mo=10(3) ao=10 uid=0 did=0 ** bug @ o=0 } 0x0x60c000000048
 [0:0]=+0.0000E+00
 [1:1]=-1.8326E-06
 [2:2]=-1.8326E-06
 [3:3]=-1.8326E-06
 [4:4]=-1.8326E-06
 [5:5]=-1.8326E-06
 [6:6]=-1.8326E-06
 [7:7]=-1.8326E-06
 [8:8]=-1.8326E-06
 [9:9]=-1.8326E-06
 [10:10]=-1.8326E-06

error: /home/matt/tpsa/gtpsa/code/mad_tpsa.c:139: : /home/matt/tpsa/gtpsa/code/mad_tpsa.c:139:
ldeniau commented 5 months ago

Well, this is not a bug... Try with TPSA_STRICT=1, TPSA_DEBUG=1, and mad_tpsa_dbgo not set, dbgf = 1, and dbga =2.

TPSA_STRICT, TPSA_DEBUG and mad_tpsa_dbgf (print function calls) are just flags, i.e. 0 or 1, to activate the feature at compile time or runtime.

mad_tpsa_dbga (check arguments) has different level, 0, 1, 2, 3: 0, disabled, 1 check tpsa validity (depends on the strict/lazy mode), 2=1+compute tpsa density (can be printed, see api), 3=2+display tpsa headers(always)+raw content(only when invalid).

mad_tpsa_dbgo is the order that no tpsa should go beyond, it is useful to debug e.g. minv where a damap is limited to some increasing order mo by calling mad_tpsa_mo, and check if it doesn't trig calculation beyond this order. Since the global truncation order has been removed for thread compliance, the limitation is based on the fact that all operators create new tpsa using mad_tpsa_same (same order) and not mad_tpsa_dflt (max order from desc).

mattsignorelli commented 5 months ago

Try with TPSA_STRICT=1, TPSA_DEBUG=1, and mad_tpsa_dbgo not set, dbgf = 1, and dbga =2.

I get the same error message with these settings

And with TPSA_DEBUG=0 and -fsanitize=address, I get

         :  R, NV =   1, MO = 10
 *******************************************************
     I   COEFFICIENT             ORDER   EXPONENTS
     1   0.0000000000000000E+00    0     0
     2   1.0000000000000000E+00    1     1
     3  -1.8325506472120096E-06    2     2
     4  -1.8325506472120096E-06    3     3
     5  -1.8325506472120096E-06    4     4
     6  -1.8325506472120096E-06    5     5
     7  -1.8325506472120096E-06    6     6
     8  -1.8325506472120096E-06    7     7
     9  -1.8325506472120096E-06    8     8
    10  -1.8325506472120096E-06    9     9
    11   1.0000000000000000E+00   10     10
ldeniau commented 5 months ago

Try with TPSA_STRICT=1, TPSA_DEBUG=1, and mad_tpsa_dbgo not set, dbgf = 1, and dbga =2.

I get the same error message with these settings

In the error message you still have the same header, there is a problem mad_tpsa_newd:281: 'r' { lo=1 hi=0 mo=10(3) ao=10 uid=0 did=0 ** bug @ o=0 } 0x0x55fbb9e74ee8 means that mad_tpsa_dbgo = 3 and it trigs the error, since bug @ o=0 means a bug in the header, here mo > dbgo.

And with TPSA_DEBUG=0 and -fsanitize=address, I get

I don't know what the sanitizer does, mais they often wrap allocated memory with tag, and I do the same in my allocator. I hope that it's not a corruption due to some side effects on my allocator...

I will try on linux tomorrow to see if I can reproduce the effect of the sanitizer.

         :  R, NV =   1, MO = 10
 *******************************************************
     I   COEFFICIENT             ORDER   EXPONENTS
     1   0.0000000000000000E+00    0     0
     2   1.0000000000000000E+00    1     1
     3  -1.8325506472120096E-06    2     2
     4  -1.8325506472120096E-06    3     3
     5  -1.8325506472120096E-06    4     4
     6  -1.8325506472120096E-06    5     5
     7  -1.8325506472120096E-06    6     6
     8  -1.8325506472120096E-06    7     7
     9  -1.8325506472120096E-06    8     8
    10  -1.8325506472120096E-06    9     9
    11   1.0000000000000000E+00   10     10
mattsignorelli commented 5 months ago

In the error message you still have the same header, there is a problem mad_tpsa_newd:281: 'r' { lo=1 hi=0 mo=10(3) ao=10 uid=0 did=0 ** bug @ o=0 } 0x0x55fbb9e74ee8 means that mad_tpsa_dbgo = 3 and it trigs the error, since bug @ o=0 means a bug in the header, here mo > dbgo.

Sorry about that, I set dgbo = 0 instead of -1. With dbgo = -1, there is no error, but there is still the corruption

I don't know what the sanitizer does, mais they often wrap allocated memory with tag, and I do the same in my allocator. I hope that it's not a corruption due to some side effects on my allocator...

I will try on linux tomorrow to see if I can reproduce the effect of the sanitizer.

That would make sense. Presumably Julia is doing something similar, and might explain why I see it when calling the C directly from Julia even without the -fsanitize=address flag to compile the library

ldeniau commented 5 months ago

I tried on linux but see nothing, including variation on orders and #variables...

I put below the code and its compilation steps (TPSA_DEBUG=1) just to be sure that we investigate on the same basis. I rewrote the print_nonzero as it should be, and using an update of mad_mono_print. Note that this C code is leaking memory (uncomment last printf which calls mad_mcollect() to not leak and see that 3744 bytes are collected) but the sanitizer detects nothing...

CODE

#include "mad_tpsa.h"

enum { NV = 1, MO = 10 };

// uses cycle to print nonzero monomials
void print_nonzero(tpsa_t* t) {
  ord_t mono[NV];
  num_t v;
  idx_t idx = -1;

  for(;;) {
    idx = mad_tpsa_cycle(t, idx, NV, mono, &v);
    if (idx<0) break;
    printf("%23.16le  ", v);
    mad_mono_print(NV,mono,0,0);
    printf("\n");
  }
}

int main(void)
{
  const desc_t *d = mad_desc_newv(NV, MO);

  mad_tpsa_dbgf = 1;
  mad_tpsa_dbga = 4;

  tpsa_t* x = mad_tpsa_newd(d, mad_tpsa_dflt);
  tpsa_t* y = mad_tpsa_newd(d, mad_tpsa_dflt);
  tpsa_t* z = mad_tpsa_newd(d, mad_tpsa_dflt);

  ord_t m[] = {MO};
  mad_tpsa_seti(x, 0, 0, 1);
  mad_tpsa_setm(y, 1, m, 0, 1);
  mad_tpsa_add(x, y, z);

  print_nonzero(z);

  mad_tpsa_print(x, "y", 0, 0, 0);
  mad_tpsa_print(y, "x", 0, 0, 0);
  mad_tpsa_print(z, "z", 0, 0, 0);

  mad_tpsa_del(x);
  mad_tpsa_del(y);
  mad_tpsa_del(z);
  mad_desc_del(0);
  //printf("gc_sz = %zu\n", mad_mcollect());
  return 0;
}

OUTPUT

$ cd libgtpsa ; gcc -std=c99 -W -Wall -Wextra -pedantic -O3 -fPIC -ffast-math -ftree-vectorize -Wno-vla-parameter -Wno-misleading-indentation -Wno-empty-body -fsanitize=address -g -I. -c *.c ; rm libgtpsa.a ; ar -ruv libgtpsa.a *.o ; cd ..
ar: creating libgtpsa.a
a - mad_bit.o
a - mad_cst.o
a - mad_ctpsa_comp.o
a - mad_ctpsa_conv.o
a - mad_ctpsa_fun.o
a - mad_ctpsa_io.o
a - mad_ctpsa_minv.o
a - mad_ctpsa_mops.o
a - mad_ctpsa.o
a - mad_ctpsa_ops.o
a - mad_desc.o
a - mad_erfw.o
a - mad_log.o
a - mad_mat.o
a - mad_mem.o
a - mad_mono.o
a - mad_num.o
a - mad_str.o
a - mad_tpsa_comp.o
a - mad_tpsa_fun.o
a - mad_tpsa_io.o
a - mad_tpsa_minv.o
a - mad_tpsa_mops.o
a - mad_tpsa.o
a - mad_tpsa_ops.o
a - mad_vec.o
$ gcc -std=c99 -W -Wall -Wextra -pedantic -O3 -fPIC -ffast-math -ftree-vectorize -g -fsanitize=address  -Ilibgtpsa -Llibgtpsa -L../../../bin/linux/ bug_in_add.c -o bug_in_add -lasan -lgtpsa -lrefblas -llapack -lgfortran -lm -ldl
$ ./bug_in_add
-> mad_tpsa_newd:277:
mad_tpsa_newd:281: 'r' { lo=1 hi=0 mo=10(255) ao=10 uid=0 did=0 r=1.00 } 0x0x60c000000048
-> mad_tpsa_print:394:

 r       :  R, NV =   1, MO = 10
 *******************************************************

         ALL COMPONENTS ZERO (EPS=1.0E-40)
<- mad_tpsa_print:441:
<- mad_tpsa_newd:281:
-> mad_tpsa_newd:277:
mad_tpsa_newd:281: 'r' { lo=1 hi=0 mo=10(255) ao=10 uid=0 did=0 r=1.00 } 0x0x60c000000108
-> mad_tpsa_print:394:

 r       :  R, NV =   1, MO = 10
 *******************************************************

         ALL COMPONENTS ZERO (EPS=1.0E-40)
<- mad_tpsa_print:441:
<- mad_tpsa_newd:281:
-> mad_tpsa_newd:277:
mad_tpsa_newd:281: 'r' { lo=1 hi=0 mo=10(255) ao=10 uid=0 did=0 r=1.00 } 0x0x60c0000001c8
-> mad_tpsa_print:394:

 r       :  R, NV =   1, MO = 10
 *******************************************************

         ALL COMPONENTS ZERO (EPS=1.0E-40)
<- mad_tpsa_print:441:
<- mad_tpsa_newd:281:
-> mad_tpsa_seti:676:
<- mad_tpsa_seti:677:
-> mad_tpsa_setm:714:
-> mad_desc_idxm:1167:
<- mad_desc_idxm:1170:
-> mad_tpsa_seti:676:
mad_tpsa_seti:698: 't' { lo=10 hi=10 mo=10(255) ao=10 uid=0 did=0 r=1.00 } 0x0x60c000000108
-> mad_tpsa_print:394:

 t       :  R, NV =   1, MO = 10
 *******************************************************
     I   COEFFICIENT             ORDER   EXPONENTS
     1   1.0000000000000000E+00   10     10
<- mad_tpsa_print:441:
<- mad_tpsa_seti:698:
<- mad_tpsa_setm:718:
-> mad_tpsa_add:343:
-> mad_tpsa_update:312:
mad_tpsa_update:315: 't' { lo=10 hi=10 mo=10(255) ao=10 uid=0 did=0 r=1.00 } 0x0x60c0000001c8
-> mad_tpsa_print:394:

 t       :  R, NV =   1, MO = 10
 *******************************************************
     I   COEFFICIENT             ORDER   EXPONENTS
     1   1.0000000000000000E+00    0     0
     2   1.0000000000000000E+00   10     10
<- mad_tpsa_print:441:
<- mad_tpsa_update:315:
<- mad_tpsa_add:352:
-> mad_tpsa_cycle:460:
<- mad_tpsa_cycle:470:
 1.0000000000000000e+00  [0]
-> mad_tpsa_cycle:460:
<- mad_tpsa_cycle:470:
 1.0000000000000000e+00  [10]
-> mad_tpsa_cycle:460:
<- mad_tpsa_cycle:465:
-> mad_tpsa_print:394:

 y       :  R, NV =   1, MO = 10
 *******************************************************
     I   COEFFICIENT             ORDER   EXPONENTS
     1   1.0000000000000000E+00    0     0
<- mad_tpsa_print:441:
-> mad_tpsa_print:394:

 x       :  R, NV =   1, MO = 10
 *******************************************************
     I   COEFFICIENT             ORDER   EXPONENTS
     1   0.0000000000000000E+00    0     0
     2   1.0000000000000000E+00   10     10
<- mad_tpsa_print:441:
-> mad_tpsa_print:394:

 z       :  R, NV =   1, MO = 10
 *******************************************************
     I   COEFFICIENT             ORDER   EXPONENTS
     1   1.0000000000000000E+00    0     0
     2   1.0000000000000000E+00   10     10
<- mad_tpsa_print:441:
-> mad_tpsa_del:294:
<- mad_tpsa_del:296:
-> mad_tpsa_del:294:
<- mad_tpsa_del:296:
-> mad_tpsa_del:294:
<- mad_tpsa_del:296:
-> mad_desc_del:1328:
<- mad_desc_del:1378:
mattsignorelli commented 5 months ago

Sorry for the delay on this, I have been busy writing IPAC papers.

With this code and latest GTPSA, I'm not currently seeing anything for setting the scalar part, but for seti setting index 1 instead of 0 I see the garbage:

CODE

#include "mad_tpsa.h"

enum { NV = 1, MO = 10 };

// uses cycle to print nonzero monomials
void print_nonzero(tpsa_t* t) {
  ord_t mono[NV];
  num_t v;
  idx_t idx = -1;

  for(;;) {
    idx = mad_tpsa_cycle(t, idx, NV, mono, &v);
    if (idx<0) break;
    printf("%23.16le  ", v);
    mad_mono_print(NV,mono,0,0);
    printf("\n");
  }
}

int main(void)
{
  const desc_t *d = mad_desc_newv(NV, MO);

  mad_tpsa_dbgf = 1;
  mad_tpsa_dbga = 4;

  tpsa_t* x = mad_tpsa_newd(d, mad_tpsa_dflt);
  tpsa_t* y = mad_tpsa_newd(d, mad_tpsa_dflt);
  tpsa_t* z = mad_tpsa_newd(d, mad_tpsa_dflt);

  ord_t m[] = {MO};
  mad_tpsa_seti(x, 1, 0, 1);   // setting the first order part
  mad_tpsa_setm(y, 1, m, 0, 1);
  mad_tpsa_add(x, y, z);

  print_nonzero(z);

  mad_tpsa_print(x, "y", 0, 0, 0);
  mad_tpsa_print(y, "x", 0, 0, 0);
  mad_tpsa_print(z, "z", 0, 0, 0);

  mad_tpsa_del(x);
  mad_tpsa_del(y);
  mad_tpsa_del(z);
  mad_desc_del(0);
  //printf("gc_sz = %zu\n", mad_mcollect());
  return 0;
}

OUTPUT

-> mad_tpsa_newd:277:
mad_tpsa_newd:281: 'r' { lo=1 hi=0 mo=10(255) ao=10 uid=0 did=0 r=1.00 } 0x0x60c000000048
-> mad_tpsa_print:394:

 r       :  R, NV =   1, MO = 10
 *******************************************************

         ALL COMPONENTS ZERO (EPS=1.0E-40)
<- mad_tpsa_print:441:
<- mad_tpsa_newd:281:
-> mad_tpsa_newd:277:
mad_tpsa_newd:281: 'r' { lo=1 hi=0 mo=10(255) ao=10 uid=0 did=0 r=1.00 } 0x0x60c000000108
-> mad_tpsa_print:394:

 r       :  R, NV =   1, MO = 10
 *******************************************************

         ALL COMPONENTS ZERO (EPS=1.0E-40)
<- mad_tpsa_print:441:
<- mad_tpsa_newd:281:
-> mad_tpsa_newd:277:
mad_tpsa_newd:281: 'r' { lo=1 hi=0 mo=10(255) ao=10 uid=0 did=0 r=1.00 } 0x0x60c0000001c8
-> mad_tpsa_print:394:

 r       :  R, NV =   1, MO = 10
 *******************************************************

         ALL COMPONENTS ZERO (EPS=1.0E-40)
<- mad_tpsa_print:441:
<- mad_tpsa_newd:281:
-> mad_tpsa_seti:676:
mad_tpsa_seti:698: 't' { lo=1 hi=1 mo=10(255) ao=10 uid=0 did=0 r=1.00 } 0x0x60c000000048
-> mad_tpsa_print:394:

 t       :  R, NV =   1, MO = 10
 *******************************************************
     I   COEFFICIENT             ORDER   EXPONENTS
     1   1.0000000000000000E+00    1     1
<- mad_tpsa_print:441:
<- mad_tpsa_seti:698:
-> mad_tpsa_setm:714:
-> mad_desc_idxm:1167:
<- mad_desc_idxm:1170:
-> mad_tpsa_seti:676:
mad_tpsa_seti:698: 't' { lo=10 hi=10 mo=10(255) ao=10 uid=0 did=0 r=1.00 } 0x0x60c000000108
-> mad_tpsa_print:394:

 t       :  R, NV =   1, MO = 10
 *******************************************************
     I   COEFFICIENT             ORDER   EXPONENTS
     1   1.0000000000000000E+00   10     10
<- mad_tpsa_print:441:
<- mad_tpsa_seti:698:
<- mad_tpsa_setm:718:
-> mad_tpsa_add:343:
-> mad_tpsa_update:312:
mad_tpsa_update:315: 't' { lo=1 hi=10 mo=10(255) ao=10 uid=0 did=0 r=1.00 } 0x0x60c0000001c8
-> mad_tpsa_print:394:

 t       :  R, NV =   1, MO = 10
 *******************************************************
     I   COEFFICIENT             ORDER   EXPONENTS
     1   1.0000000000000000E+00    1     1
     2  -1.8325506472120096E-06    2     2
     3  -1.8325506472120096E-06    3     3
     4  -1.8325506472120096E-06    4     4
     5  -1.8325506472120096E-06    5     5
     6  -1.8325506472120096E-06    6     6
     7  -1.8325506472120096E-06    7     7
     8  -1.8325506472120096E-06    8     8
     9  -1.8325506472120096E-06    9     9
    10   1.0000000000000000E+00   10     10
<- mad_tpsa_print:441:
<- mad_tpsa_update:315:
<- mad_tpsa_add:352:
-> mad_tpsa_cycle:460:
<- mad_tpsa_cycle:470:
 1.0000000000000000e+00  [1]
-> mad_tpsa_cycle:460:
<- mad_tpsa_cycle:470:
-1.8325506472120096e-06  [2]
-> mad_tpsa_cycle:460:
<- mad_tpsa_cycle:470:
-1.8325506472120096e-06  [3]
-> mad_tpsa_cycle:460:
<- mad_tpsa_cycle:470:
-1.8325506472120096e-06  [4]
-> mad_tpsa_cycle:460:
<- mad_tpsa_cycle:470:
-1.8325506472120096e-06  [5]
-> mad_tpsa_cycle:460:
<- mad_tpsa_cycle:470:
-1.8325506472120096e-06  [6]
-> mad_tpsa_cycle:460:
<- mad_tpsa_cycle:470:
-1.8325506472120096e-06  [7]
-> mad_tpsa_cycle:460:
<- mad_tpsa_cycle:470:
-1.8325506472120096e-06  [8]
-> mad_tpsa_cycle:460:
<- mad_tpsa_cycle:470:
-1.8325506472120096e-06  [9]
-> mad_tpsa_cycle:460:
<- mad_tpsa_cycle:470:
 1.0000000000000000e+00  [10]
-> mad_tpsa_cycle:460:
<- mad_tpsa_cycle:465:
-> mad_tpsa_print:394:

 y       :  R, NV =   1, MO = 10
 *******************************************************
     I   COEFFICIENT             ORDER   EXPONENTS
     1   0.0000000000000000E+00    0     0
     2   1.0000000000000000E+00    1     1
<- mad_tpsa_print:441:
-> mad_tpsa_print:394:

 x       :  R, NV =   1, MO = 10
 *******************************************************
     I   COEFFICIENT             ORDER   EXPONENTS
     1   0.0000000000000000E+00    0     0
     2   1.0000000000000000E+00   10     10
<- mad_tpsa_print:441:
-> mad_tpsa_print:394:

 z       :  R, NV =   1, MO = 10
 *******************************************************
     I   COEFFICIENT             ORDER   EXPONENTS
     1   0.0000000000000000E+00    0     0
     2   1.0000000000000000E+00    1     1
     3  -1.8325506472120096E-06    2     2
     4  -1.8325506472120096E-06    3     3
     5  -1.8325506472120096E-06    4     4
     6  -1.8325506472120096E-06    5     5
     7  -1.8325506472120096E-06    6     6
     8  -1.8325506472120096E-06    7     7
     9  -1.8325506472120096E-06    8     8
    10  -1.8325506472120096E-06    9     9
    11   1.0000000000000000E+00   10     10
<- mad_tpsa_print:441:
-> mad_tpsa_del:294:
<- mad_tpsa_del:296:
-> mad_tpsa_del:294:
<- mad_tpsa_del:296:
-> mad_tpsa_del:294:
<- mad_tpsa_del:296:
-> mad_desc_del:1328:
<- mad_desc_del:1378:

Since it is some kind of memory corruption, it is possible that I could see the garbage again for setting scalar part when I'm using more system resources.

mattsignorelli commented 5 months ago

Here is the output of valgrind I get for the code

==12657== Memcheck, a memory error detector
==12657== Copyright (C) 2002-2017, and GNU GPL'd, by Julian Seward et al.
==12657== Using Valgrind-3.18.1 and LibVEX; rerun with -h for copyright info
==12657== Command: ./bug
==12657==
-> mad_tpsa_newd:277:
mad_tpsa_newd:281: 'r' { lo=1 hi=0 mo=10(255) ao=10 uid=0 did=0 r=1.00 } 0x0x5745458
-> mad_tpsa_print:394:

 r       :  R, NV =   1, MO = 10
 *******************************************************

         ALL COMPONENTS ZERO (EPS=1.0E-40)
<- mad_tpsa_print:441:
<- mad_tpsa_newd:281:
-> mad_tpsa_newd:277:
mad_tpsa_newd:281: 'r' { lo=1 hi=0 mo=10(255) ao=10 uid=0 did=0 r=1.00 } 0x0x5745518
-> mad_tpsa_print:394:

 r       :  R, NV =   1, MO = 10
 *******************************************************

         ALL COMPONENTS ZERO (EPS=1.0E-40)
<- mad_tpsa_print:441:
<- mad_tpsa_newd:281:
-> mad_tpsa_newd:277:
mad_tpsa_newd:281: 'r' { lo=1 hi=0 mo=10(255) ao=10 uid=0 did=0 r=1.00 } 0x0x57455d8
-> mad_tpsa_print:394:

 r       :  R, NV =   1, MO = 10
 *******************************************************

         ALL COMPONENTS ZERO (EPS=1.0E-40)
<- mad_tpsa_print:441:
<- mad_tpsa_newd:281:
-> mad_tpsa_seti:676:
mad_tpsa_seti:698: 't' { lo=1 hi=1 mo=10(255) ao=10 uid=0 did=0 r=1.00 } 0x0x5745458
-> mad_tpsa_print:394:

 t       :  R, NV =   1, MO = 10
 *******************************************************
     I   COEFFICIENT             ORDER   EXPONENTS
     1   1.0000000000000000E+00    1     1
<- mad_tpsa_print:441:
<- mad_tpsa_seti:698:
-> mad_tpsa_setm:714:
-> mad_desc_idxm:1167:
<- mad_desc_idxm:1170:
-> mad_tpsa_seti:676:
mad_tpsa_seti:698: 't' { lo=10 hi=10 mo=10(255) ao=10 uid=0 did=0 r=1.00 } 0x0x5745518
-> mad_tpsa_print:394:

 t       :  R, NV =   1, MO = 10
 *******************************************************
     I   COEFFICIENT             ORDER   EXPONENTS
     1   1.0000000000000000E+00   10     10
<- mad_tpsa_print:441:
<- mad_tpsa_seti:698:
<- mad_tpsa_setm:718:
-> mad_tpsa_add:343:
-> mad_tpsa_update:312:
==12657== Use of uninitialised value of size 8
==12657==    at 0x48B7A48: UnknownInlinedFun (mad_tpsa.c:63)
==12657==    by 0x48B7A48: UnknownInlinedFun (mad_tpsa.c:89)
==12657==    by 0x48B7A48: UnknownInlinedFun (mad_tpsa.c:69)
==12657==    by 0x48B7A48: mad_tpsa_debug (mad_tpsa.c:110)
==12657==    by 0x48B8415: mad_tpsa_update (mad_tpsa.c:315)
==12657==    by 0x48C4E58: mad_tpsa_add (mad_tpsa_ops.c:350)
==12657==    by 0x1092AB: main (bug.c:34)
==12657==  Uninitialised value was created by a heap allocation
==12657==    at 0x4848899: malloc (in /usr/libexec/valgrind/vgpreload_memcheck-amd64-linux.so)
==12657==    by 0x4869BCC: mad_malloc (mad_mem.c:157)
==12657==    by 0x48B7FE7: mad_tpsa_newd (mad_tpsa.c:279)
==12657==    by 0x109242: main (bug.c:28)
==12657==
==12657== Conditional jump or move depends on uninitialised value(s)
==12657==    at 0x4961CB8: __printf_fp_l (printf_fp.c:396)
==12657==    by 0x497B3A0: __printf_fp_spec (vfprintf-internal.c:354)
==12657==    by 0x497B3A0: printf_positional (vfprintf-internal.c:1953)
==12657==    by 0x497C335: __vfprintf_internal (vfprintf-internal.c:1602)
==12657==    by 0x4A3BD12: __fprintf_chk (fprintf_chk.c:33)
==12657==    by 0x48B7AFE: UnknownInlinedFun (stdio2.h:105)
==12657==    by 0x48B7AFE: mad_tpsa_debug (mad_tpsa.c:122)
==12657==    by 0x48B8415: mad_tpsa_update (mad_tpsa.c:315)
==12657==    by 0x48C4E58: mad_tpsa_add (mad_tpsa_ops.c:350)
==12657==    by 0x1092AB: main (bug.c:34)
==12657==  Uninitialised value was created by a heap allocation
==12657==    at 0x4848899: malloc (in /usr/libexec/valgrind/vgpreload_memcheck-amd64-linux.so)
==12657==    by 0x4869BCC: mad_malloc (mad_mem.c:157)
==12657==    by 0x48B7FE7: mad_tpsa_newd (mad_tpsa.c:279)
==12657==    by 0x109242: main (bug.c:28)
==12657==
==12657== Conditional jump or move depends on uninitialised value(s)
==12657==    at 0x4961CD2: __printf_fp_l (printf_fp.c:396)
==12657==    by 0x497B3A0: __printf_fp_spec (vfprintf-internal.c:354)
==12657==    by 0x497B3A0: printf_positional (vfprintf-internal.c:1953)
==12657==    by 0x497C335: __vfprintf_internal (vfprintf-internal.c:1602)
==12657==    by 0x4A3BD12: __fprintf_chk (fprintf_chk.c:33)
==12657==    by 0x48B7AFE: UnknownInlinedFun (stdio2.h:105)
==12657==    by 0x48B7AFE: mad_tpsa_debug (mad_tpsa.c:122)
==12657==    by 0x48B8415: mad_tpsa_update (mad_tpsa.c:315)
==12657==    by 0x48C4E58: mad_tpsa_add (mad_tpsa_ops.c:350)
==12657==    by 0x1092AB: main (bug.c:34)
==12657==  Uninitialised value was created by a heap allocation
==12657==    at 0x4848899: malloc (in /usr/libexec/valgrind/vgpreload_memcheck-amd64-linux.so)
==12657==    by 0x4869BCC: mad_malloc (mad_mem.c:157)
==12657==    by 0x48B7FE7: mad_tpsa_newd (mad_tpsa.c:279)
==12657==    by 0x109242: main (bug.c:28)
==12657==
==12657== Conditional jump or move depends on uninitialised value(s)
==12657==    at 0x495D50A: __mpn_extract_double (dbl2mpn.c:56)
==12657==    by 0x4961FCE: __printf_fp_l (printf_fp.c:396)
==12657==    by 0x497B3A0: __printf_fp_spec (vfprintf-internal.c:354)
==12657==    by 0x497B3A0: printf_positional (vfprintf-internal.c:1953)
==12657==    by 0x497C335: __vfprintf_internal (vfprintf-internal.c:1602)
==12657==    by 0x4A3BD12: __fprintf_chk (fprintf_chk.c:33)
==12657==    by 0x48B7AFE: UnknownInlinedFun (stdio2.h:105)
==12657==    by 0x48B7AFE: mad_tpsa_debug (mad_tpsa.c:122)
==12657==    by 0x48B8415: mad_tpsa_update (mad_tpsa.c:315)
==12657==    by 0x48C4E58: mad_tpsa_add (mad_tpsa_ops.c:350)
==12657==    by 0x1092AB: main (bug.c:34)
==12657==  Uninitialised value was created by a heap allocation
==12657==    at 0x4848899: malloc (in /usr/libexec/valgrind/vgpreload_memcheck-amd64-linux.so)
==12657==    by 0x4869BCC: mad_malloc (mad_mem.c:157)
==12657==    by 0x48B7FE7: mad_tpsa_newd (mad_tpsa.c:279)
==12657==    by 0x109242: main (bug.c:28)
==12657==
==12657== Conditional jump or move depends on uninitialised value(s)
==12657==    at 0x496201E: __printf_fp_l (printf_fp.c:437)
==12657==    by 0x497B3A0: __printf_fp_spec (vfprintf-internal.c:354)
==12657==    by 0x497B3A0: printf_positional (vfprintf-internal.c:1953)
==12657==    by 0x497C335: __vfprintf_internal (vfprintf-internal.c:1602)
==12657==    by 0x4A3BD12: __fprintf_chk (fprintf_chk.c:33)
==12657==    by 0x48B7AFE: UnknownInlinedFun (stdio2.h:105)
==12657==    by 0x48B7AFE: mad_tpsa_debug (mad_tpsa.c:122)
==12657==    by 0x48B8415: mad_tpsa_update (mad_tpsa.c:315)
==12657==    by 0x48C4E58: mad_tpsa_add (mad_tpsa_ops.c:350)
==12657==    by 0x1092AB: main (bug.c:34)
==12657==  Uninitialised value was created by a heap allocation
==12657==    at 0x4848899: malloc (in /usr/libexec/valgrind/vgpreload_memcheck-amd64-linux.so)
==12657==    by 0x4869BCC: mad_malloc (mad_mem.c:157)
==12657==    by 0x48B7FE7: mad_tpsa_newd (mad_tpsa.c:279)
==12657==    by 0x109242: main (bug.c:28)
==12657==
==12657== Conditional jump or move depends on uninitialised value(s)
==12657==    at 0x4962041: __printf_fp_l (printf_fp.c:437)
==12657==    by 0x497B3A0: __printf_fp_spec (vfprintf-internal.c:354)
==12657==    by 0x497B3A0: printf_positional (vfprintf-internal.c:1953)
==12657==    by 0x497C335: __vfprintf_internal (vfprintf-internal.c:1602)
==12657==    by 0x4A3BD12: __fprintf_chk (fprintf_chk.c:33)
==12657==    by 0x48B7AFE: UnknownInlinedFun (stdio2.h:105)
==12657==    by 0x48B7AFE: mad_tpsa_debug (mad_tpsa.c:122)
==12657==    by 0x48B8415: mad_tpsa_update (mad_tpsa.c:315)
==12657==    by 0x48C4E58: mad_tpsa_add (mad_tpsa_ops.c:350)
==12657==    by 0x1092AB: main (bug.c:34)
==12657==  Uninitialised value was created by a heap allocation
==12657==    at 0x4848899: malloc (in /usr/libexec/valgrind/vgpreload_memcheck-amd64-linux.so)
==12657==    by 0x4869BCC: mad_malloc (mad_mem.c:157)
==12657==    by 0x48B7FE7: mad_tpsa_newd (mad_tpsa.c:279)
==12657==    by 0x109242: main (bug.c:28)
==12657==
==12657== Use of uninitialised value of size 8
==12657==    at 0x4962902: __printf_fp_l (printf_fp.c:437)
==12657==    by 0x497B3A0: __printf_fp_spec (vfprintf-internal.c:354)
==12657==    by 0x497B3A0: printf_positional (vfprintf-internal.c:1953)
==12657==    by 0x497C335: __vfprintf_internal (vfprintf-internal.c:1602)
==12657==    by 0x4A3BD12: __fprintf_chk (fprintf_chk.c:33)
==12657==    by 0x48B7AFE: UnknownInlinedFun (stdio2.h:105)
==12657==    by 0x48B7AFE: mad_tpsa_debug (mad_tpsa.c:122)
==12657==    by 0x48B8415: mad_tpsa_update (mad_tpsa.c:315)
==12657==    by 0x48C4E58: mad_tpsa_add (mad_tpsa_ops.c:350)
==12657==    by 0x1092AB: main (bug.c:34)
==12657==  Uninitialised value was created by a heap allocation
==12657==    at 0x4848899: malloc (in /usr/libexec/valgrind/vgpreload_memcheck-amd64-linux.so)
==12657==    by 0x4869BCC: mad_malloc (mad_mem.c:157)
==12657==    by 0x48B7FE7: mad_tpsa_newd (mad_tpsa.c:279)
==12657==    by 0x109242: main (bug.c:28)
==12657==
==12657== Conditional jump or move depends on uninitialised value(s)
==12657==    at 0x4962071: __printf_fp_l (printf_fp.c:438)
==12657==    by 0x497B3A0: __printf_fp_spec (vfprintf-internal.c:354)
==12657==    by 0x497B3A0: printf_positional (vfprintf-internal.c:1953)
==12657==    by 0x497C335: __vfprintf_internal (vfprintf-internal.c:1602)
==12657==    by 0x4A3BD12: __fprintf_chk (fprintf_chk.c:33)
==12657==    by 0x48B7AFE: UnknownInlinedFun (stdio2.h:105)
==12657==    by 0x48B7AFE: mad_tpsa_debug (mad_tpsa.c:122)
==12657==    by 0x48B8415: mad_tpsa_update (mad_tpsa.c:315)
==12657==    by 0x48C4E58: mad_tpsa_add (mad_tpsa_ops.c:350)
==12657==    by 0x1092AB: main (bug.c:34)
==12657==  Uninitialised value was created by a heap allocation
==12657==    at 0x4848899: malloc (in /usr/libexec/valgrind/vgpreload_memcheck-amd64-linux.so)
==12657==    by 0x4869BCC: mad_malloc (mad_mem.c:157)
==12657==    by 0x48B7FE7: mad_tpsa_newd (mad_tpsa.c:279)
==12657==    by 0x109242: main (bug.c:28)
==12657==
==12657== Conditional jump or move depends on uninitialised value(s)
==12657==    at 0x4962094: __printf_fp_l (printf_fp.c:438)
==12657==    by 0x497B3A0: __printf_fp_spec (vfprintf-internal.c:354)
==12657==    by 0x497B3A0: printf_positional (vfprintf-internal.c:1953)
==12657==    by 0x497C335: __vfprintf_internal (vfprintf-internal.c:1602)
==12657==    by 0x4A3BD12: __fprintf_chk (fprintf_chk.c:33)
==12657==    by 0x48B7AFE: UnknownInlinedFun (stdio2.h:105)
==12657==    by 0x48B7AFE: mad_tpsa_debug (mad_tpsa.c:122)
==12657==    by 0x48B8415: mad_tpsa_update (mad_tpsa.c:315)
==12657==    by 0x48C4E58: mad_tpsa_add (mad_tpsa_ops.c:350)
==12657==    by 0x1092AB: main (bug.c:34)
==12657==  Uninitialised value was created by a heap allocation
==12657==    at 0x4848899: malloc (in /usr/libexec/valgrind/vgpreload_memcheck-amd64-linux.so)
==12657==    by 0x4869BCC: mad_malloc (mad_mem.c:157)
==12657==    by 0x48B7FE7: mad_tpsa_newd (mad_tpsa.c:279)
==12657==    by 0x109242: main (bug.c:28)
==12657==
==12657== Use of uninitialised value of size 8
==12657==    at 0x4962096: __printf_fp_l (printf_fp.c:438)
==12657==    by 0x497B3A0: __printf_fp_spec (vfprintf-internal.c:354)
==12657==    by 0x497B3A0: printf_positional (vfprintf-internal.c:1953)
==12657==    by 0x497C335: __vfprintf_internal (vfprintf-internal.c:1602)
==12657==    by 0x4A3BD12: __fprintf_chk (fprintf_chk.c:33)
==12657==    by 0x48B7AFE: UnknownInlinedFun (stdio2.h:105)
==12657==    by 0x48B7AFE: mad_tpsa_debug (mad_tpsa.c:122)
==12657==    by 0x48B8415: mad_tpsa_update (mad_tpsa.c:315)
==12657==    by 0x48C4E58: mad_tpsa_add (mad_tpsa_ops.c:350)
==12657==    by 0x1092AB: main (bug.c:34)
==12657==  Uninitialised value was created by a heap allocation
==12657==    at 0x4848899: malloc (in /usr/libexec/valgrind/vgpreload_memcheck-amd64-linux.so)
==12657==    by 0x4869BCC: mad_malloc (mad_mem.c:157)
==12657==    by 0x48B7FE7: mad_tpsa_newd (mad_tpsa.c:279)
==12657==    by 0x109242: main (bug.c:28)
==12657==
==12657== Conditional jump or move depends on uninitialised value(s)
==12657==    at 0x49620BF: __printf_fp_l (printf_fp.c:439)
==12657==    by 0x497B3A0: __printf_fp_spec (vfprintf-internal.c:354)
==12657==    by 0x497B3A0: printf_positional (vfprintf-internal.c:1953)
==12657==    by 0x497C335: __vfprintf_internal (vfprintf-internal.c:1602)
==12657==    by 0x4A3BD12: __fprintf_chk (fprintf_chk.c:33)
==12657==    by 0x48B7AFE: UnknownInlinedFun (stdio2.h:105)
==12657==    by 0x48B7AFE: mad_tpsa_debug (mad_tpsa.c:122)
==12657==    by 0x48B8415: mad_tpsa_update (mad_tpsa.c:315)
==12657==    by 0x48C4E58: mad_tpsa_add (mad_tpsa_ops.c:350)
==12657==    by 0x1092AB: main (bug.c:34)
==12657==  Uninitialised value was created by a heap allocation
==12657==    at 0x4848899: malloc (in /usr/libexec/valgrind/vgpreload_memcheck-amd64-linux.so)
==12657==    by 0x4869BCC: mad_malloc (mad_mem.c:157)
==12657==    by 0x48B7FE7: mad_tpsa_newd (mad_tpsa.c:279)
==12657==    by 0x109242: main (bug.c:28)
==12657==
==12657== Conditional jump or move depends on uninitialised value(s)
==12657==    at 0x49620E4: __printf_fp_l (printf_fp.c:439)
==12657==    by 0x497B3A0: __printf_fp_spec (vfprintf-internal.c:354)
==12657==    by 0x497B3A0: printf_positional (vfprintf-internal.c:1953)
==12657==    by 0x497C335: __vfprintf_internal (vfprintf-internal.c:1602)
==12657==    by 0x4A3BD12: __fprintf_chk (fprintf_chk.c:33)
==12657==    by 0x48B7AFE: UnknownInlinedFun (stdio2.h:105)
==12657==    by 0x48B7AFE: mad_tpsa_debug (mad_tpsa.c:122)
==12657==    by 0x48B8415: mad_tpsa_update (mad_tpsa.c:315)
==12657==    by 0x48C4E58: mad_tpsa_add (mad_tpsa_ops.c:350)
==12657==    by 0x1092AB: main (bug.c:34)
==12657==  Uninitialised value was created by a heap allocation
==12657==    at 0x4848899: malloc (in /usr/libexec/valgrind/vgpreload_memcheck-amd64-linux.so)
==12657==    by 0x4869BCC: mad_malloc (mad_mem.c:157)
==12657==    by 0x48B7FE7: mad_tpsa_newd (mad_tpsa.c:279)
==12657==    by 0x109242: main (bug.c:28)
==12657==
==12657== Use of uninitialised value of size 8
==12657==    at 0x49620E6: __printf_fp_l (printf_fp.c:439)
==12657==    by 0x497B3A0: __printf_fp_spec (vfprintf-internal.c:354)
==12657==    by 0x497B3A0: printf_positional (vfprintf-internal.c:1953)
==12657==    by 0x497C335: __vfprintf_internal (vfprintf-internal.c:1602)
==12657==    by 0x4A3BD12: __fprintf_chk (fprintf_chk.c:33)
==12657==    by 0x48B7AFE: UnknownInlinedFun (stdio2.h:105)
==12657==    by 0x48B7AFE: mad_tpsa_debug (mad_tpsa.c:122)
==12657==    by 0x48B8415: mad_tpsa_update (mad_tpsa.c:315)
==12657==    by 0x48C4E58: mad_tpsa_add (mad_tpsa_ops.c:350)
==12657==    by 0x1092AB: main (bug.c:34)
==12657==  Uninitialised value was created by a heap allocation
==12657==    at 0x4848899: malloc (in /usr/libexec/valgrind/vgpreload_memcheck-amd64-linux.so)
==12657==    by 0x4869BCC: mad_malloc (mad_mem.c:157)
==12657==    by 0x48B7FE7: mad_tpsa_newd (mad_tpsa.c:279)
==12657==    by 0x109242: main (bug.c:28)
==12657==
==12657== Conditional jump or move depends on uninitialised value(s)
==12657==    at 0x4962104: __printf_fp_l (printf_fp.c:446)
==12657==    by 0x497B3A0: __printf_fp_spec (vfprintf-internal.c:354)
==12657==    by 0x497B3A0: printf_positional (vfprintf-internal.c:1953)
==12657==    by 0x497C335: __vfprintf_internal (vfprintf-internal.c:1602)
==12657==    by 0x4A3BD12: __fprintf_chk (fprintf_chk.c:33)
==12657==    by 0x48B7AFE: UnknownInlinedFun (stdio2.h:105)
==12657==    by 0x48B7AFE: mad_tpsa_debug (mad_tpsa.c:122)
==12657==    by 0x48B8415: mad_tpsa_update (mad_tpsa.c:315)
==12657==    by 0x48C4E58: mad_tpsa_add (mad_tpsa_ops.c:350)
==12657==    by 0x1092AB: main (bug.c:34)
==12657==  Uninitialised value was created by a heap allocation
==12657==    at 0x4848899: malloc (in /usr/libexec/valgrind/vgpreload_memcheck-amd64-linux.so)
==12657==    by 0x4869BCC: mad_malloc (mad_mem.c:157)
==12657==    by 0x48B7FE7: mad_tpsa_newd (mad_tpsa.c:279)
==12657==    by 0x109242: main (bug.c:28)
==12657==
==12657== Conditional jump or move depends on uninitialised value(s)
==12657==    at 0x496319D: __printf_fp_l (printf_fp.c:649)
==12657==    by 0x497B3A0: __printf_fp_spec (vfprintf-internal.c:354)
==12657==    by 0x497B3A0: printf_positional (vfprintf-internal.c:1953)
==12657==    by 0x497C335: __vfprintf_internal (vfprintf-internal.c:1602)
==12657==    by 0x4A3BD12: __fprintf_chk (fprintf_chk.c:33)
==12657==    by 0x48B7AFE: UnknownInlinedFun (stdio2.h:105)
==12657==    by 0x48B7AFE: mad_tpsa_debug (mad_tpsa.c:122)
==12657==    by 0x48B8415: mad_tpsa_update (mad_tpsa.c:315)
==12657==    by 0x48C4E58: mad_tpsa_add (mad_tpsa_ops.c:350)
==12657==    by 0x1092AB: main (bug.c:34)
==12657==  Uninitialised value was created by a heap allocation
==12657==    at 0x4848899: malloc (in /usr/libexec/valgrind/vgpreload_memcheck-amd64-linux.so)
==12657==    by 0x4869BCC: mad_malloc (mad_mem.c:157)
==12657==    by 0x48B7FE7: mad_tpsa_newd (mad_tpsa.c:279)
==12657==    by 0x109242: main (bug.c:28)
==12657==
==12657== Use of uninitialised value of size 8
==12657==    at 0x4963489: __printf_fp_l (printf_fp.c:665)
==12657==    by 0x497B3A0: __printf_fp_spec (vfprintf-internal.c:354)
==12657==    by 0x497B3A0: printf_positional (vfprintf-internal.c:1953)
==12657==    by 0x497C335: __vfprintf_internal (vfprintf-internal.c:1602)
==12657==    by 0x4A3BD12: __fprintf_chk (fprintf_chk.c:33)
==12657==    by 0x48B7AFE: UnknownInlinedFun (stdio2.h:105)
==12657==    by 0x48B7AFE: mad_tpsa_debug (mad_tpsa.c:122)
==12657==    by 0x48B8415: mad_tpsa_update (mad_tpsa.c:315)
==12657==    by 0x48C4E58: mad_tpsa_add (mad_tpsa_ops.c:350)
==12657==    by 0x1092AB: main (bug.c:34)
==12657==  Uninitialised value was created by a heap allocation
==12657==    at 0x4848899: malloc (in /usr/libexec/valgrind/vgpreload_memcheck-amd64-linux.so)
==12657==    by 0x4869BCC: mad_malloc (mad_mem.c:157)
==12657==    by 0x48B7FE7: mad_tpsa_newd (mad_tpsa.c:279)
==12657==    by 0x109242: main (bug.c:28)
==12657==
==12657== Use of uninitialised value of size 8
==12657==    at 0x495BD6C: __mpn_lshift (lshift.S:59)
==12657==    by 0x496348D: __printf_fp_l (printf_fp.c:665)
==12657==    by 0x497B3A0: __printf_fp_spec (vfprintf-internal.c:354)
==12657==    by 0x497B3A0: printf_positional (vfprintf-internal.c:1953)
==12657==    by 0x497C335: __vfprintf_internal (vfprintf-internal.c:1602)
==12657==    by 0x4A3BD12: __fprintf_chk (fprintf_chk.c:33)
==12657==    by 0x48B7AFE: UnknownInlinedFun (stdio2.h:105)
==12657==    by 0x48B7AFE: mad_tpsa_debug (mad_tpsa.c:122)
==12657==    by 0x48B8415: mad_tpsa_update (mad_tpsa.c:315)
==12657==    by 0x48C4E58: mad_tpsa_add (mad_tpsa_ops.c:350)
==12657==    by 0x1092AB: main (bug.c:34)
==12657==  Uninitialised value was created by a heap allocation
==12657==    at 0x4848899: malloc (in /usr/libexec/valgrind/vgpreload_memcheck-amd64-linux.so)
==12657==    by 0x4869BCC: mad_malloc (mad_mem.c:157)
==12657==    by 0x48B7FE7: mad_tpsa_newd (mad_tpsa.c:279)
==12657==    by 0x109242: main (bug.c:28)
==12657==
==12657== Use of uninitialised value of size 8
==12657==    at 0x495BD6F: __mpn_lshift (lshift.S:60)
==12657==    by 0x496348D: __printf_fp_l (printf_fp.c:665)
==12657==    by 0x497B3A0: __printf_fp_spec (vfprintf-internal.c:354)
==12657==    by 0x497B3A0: printf_positional (vfprintf-internal.c:1953)
==12657==    by 0x497C335: __vfprintf_internal (vfprintf-internal.c:1602)
==12657==    by 0x4A3BD12: __fprintf_chk (fprintf_chk.c:33)
==12657==    by 0x48B7AFE: UnknownInlinedFun (stdio2.h:105)
==12657==    by 0x48B7AFE: mad_tpsa_debug (mad_tpsa.c:122)
==12657==    by 0x48B8415: mad_tpsa_update (mad_tpsa.c:315)
==12657==    by 0x48C4E58: mad_tpsa_add (mad_tpsa_ops.c:350)
==12657==    by 0x1092AB: main (bug.c:34)
==12657==  Uninitialised value was created by a heap allocation
==12657==    at 0x4848899: malloc (in /usr/libexec/valgrind/vgpreload_memcheck-amd64-linux.so)
==12657==    by 0x4869BCC: mad_malloc (mad_mem.c:157)
==12657==    by 0x48B7FE7: mad_tpsa_newd (mad_tpsa.c:279)
==12657==    by 0x109242: main (bug.c:28)
==12657==
==12657== Use of uninitialised value of size 8
==12657==    at 0x49634CA: __printf_fp_l (printf_fp.c:666)
==12657==    by 0x497B3A0: __printf_fp_spec (vfprintf-internal.c:354)
==12657==    by 0x497B3A0: printf_positional (vfprintf-internal.c:1953)
==12657==    by 0x497C335: __vfprintf_internal (vfprintf-internal.c:1602)
==12657==    by 0x4A3BD12: __fprintf_chk (fprintf_chk.c:33)
==12657==    by 0x48B7AFE: UnknownInlinedFun (stdio2.h:105)
==12657==    by 0x48B7AFE: mad_tpsa_debug (mad_tpsa.c:122)
==12657==    by 0x48B8415: mad_tpsa_update (mad_tpsa.c:315)
==12657==    by 0x48C4E58: mad_tpsa_add (mad_tpsa_ops.c:350)
==12657==    by 0x1092AB: main (bug.c:34)
==12657==  Uninitialised value was created by a heap allocation
==12657==    at 0x4848899: malloc (in /usr/libexec/valgrind/vgpreload_memcheck-amd64-linux.so)
==12657==    by 0x4869BCC: mad_malloc (mad_mem.c:157)
==12657==    by 0x48B7FE7: mad_tpsa_newd (mad_tpsa.c:279)
==12657==    by 0x109242: main (bug.c:28)
==12657==
==12657== Conditional jump or move depends on uninitialised value(s)
==12657==    at 0x496358C: __printf_fp_l (printf_fp.c:677)
==12657==    by 0x497B3A0: __printf_fp_spec (vfprintf-internal.c:354)
==12657==    by 0x497B3A0: printf_positional (vfprintf-internal.c:1953)
==12657==    by 0x497C335: __vfprintf_internal (vfprintf-internal.c:1602)
==12657==    by 0x4A3BD12: __fprintf_chk (fprintf_chk.c:33)
==12657==    by 0x48B7AFE: UnknownInlinedFun (stdio2.h:105)
==12657==    by 0x48B7AFE: mad_tpsa_debug (mad_tpsa.c:122)
==12657==    by 0x48B8415: mad_tpsa_update (mad_tpsa.c:315)
==12657==    by 0x48C4E58: mad_tpsa_add (mad_tpsa_ops.c:350)
==12657==    by 0x1092AB: main (bug.c:34)
==12657==  Uninitialised value was created by a heap allocation
==12657==    at 0x4848899: malloc (in /usr/libexec/valgrind/vgpreload_memcheck-amd64-linux.so)
==12657==    by 0x4869BCC: mad_malloc (mad_mem.c:157)
==12657==    by 0x48B7FE7: mad_tpsa_newd (mad_tpsa.c:279)
==12657==    by 0x109242: main (bug.c:28)
==12657==
==12657== Conditional jump or move depends on uninitialised value(s)
==12657==    at 0x496357F: __printf_fp_l (printf_fp.c:789)
==12657==    by 0x497B3A0: __printf_fp_spec (vfprintf-internal.c:354)
==12657==    by 0x497B3A0: printf_positional (vfprintf-internal.c:1953)
==12657==    by 0x497C335: __vfprintf_internal (vfprintf-internal.c:1602)
==12657==    by 0x4A3BD12: __fprintf_chk (fprintf_chk.c:33)
==12657==    by 0x48B7AFE: UnknownInlinedFun (stdio2.h:105)
==12657==    by 0x48B7AFE: mad_tpsa_debug (mad_tpsa.c:122)
==12657==    by 0x48B8415: mad_tpsa_update (mad_tpsa.c:315)
==12657==    by 0x48C4E58: mad_tpsa_add (mad_tpsa_ops.c:350)
==12657==    by 0x1092AB: main (bug.c:34)
==12657==  Uninitialised value was created by a heap allocation
==12657==    at 0x4848899: malloc (in /usr/libexec/valgrind/vgpreload_memcheck-amd64-linux.so)
==12657==    by 0x4869BCC: mad_malloc (mad_mem.c:157)
==12657==    by 0x48B7FE7: mad_tpsa_newd (mad_tpsa.c:279)
==12657==    by 0x109242: main (bug.c:28)
==12657==
==12657== Conditional jump or move depends on uninitialised value(s)
==12657==    at 0x4963AFC: __printf_fp_l (printf_fp.c:791)
==12657==    by 0x497B3A0: __printf_fp_spec (vfprintf-internal.c:354)
==12657==    by 0x497B3A0: printf_positional (vfprintf-internal.c:1953)
==12657==    by 0x497C335: __vfprintf_internal (vfprintf-internal.c:1602)
==12657==    by 0x4A3BD12: __fprintf_chk (fprintf_chk.c:33)
==12657==    by 0x48B7AFE: UnknownInlinedFun (stdio2.h:105)
==12657==    by 0x48B7AFE: mad_tpsa_debug (mad_tpsa.c:122)
==12657==    by 0x48B8415: mad_tpsa_update (mad_tpsa.c:315)
==12657==    by 0x48C4E58: mad_tpsa_add (mad_tpsa_ops.c:350)
==12657==    by 0x1092AB: main (bug.c:34)
==12657==  Uninitialised value was created by a heap allocation
==12657==    at 0x4848899: malloc (in /usr/libexec/valgrind/vgpreload_memcheck-amd64-linux.so)
==12657==    by 0x4869BCC: mad_malloc (mad_mem.c:157)
==12657==    by 0x48B7FE7: mad_tpsa_newd (mad_tpsa.c:279)
==12657==    by 0x109242: main (bug.c:28)
==12657==
==12657== Use of uninitialised value of size 8
==12657==    at 0x495C428: __mpn_mul_1 (mul_1.S:36)
==12657==    by 0x4963B1D: __printf_fp_l (printf_fp.c:795)
==12657==    by 0x497B3A0: __printf_fp_spec (vfprintf-internal.c:354)
==12657==    by 0x497B3A0: printf_positional (vfprintf-internal.c:1953)
==12657==    by 0x497C335: __vfprintf_internal (vfprintf-internal.c:1602)
==12657==    by 0x4A3BD12: __fprintf_chk (fprintf_chk.c:33)
==12657==    by 0x48B7AFE: UnknownInlinedFun (stdio2.h:105)
==12657==    by 0x48B7AFE: mad_tpsa_debug (mad_tpsa.c:122)
==12657==    by 0x48B8415: mad_tpsa_update (mad_tpsa.c:315)
==12657==    by 0x48C4E58: mad_tpsa_add (mad_tpsa_ops.c:350)
==12657==    by 0x1092AB: main (bug.c:34)
==12657==  Uninitialised value was created by a heap allocation
==12657==    at 0x4848899: malloc (in /usr/libexec/valgrind/vgpreload_memcheck-amd64-linux.so)
==12657==    by 0x4869BCC: mad_malloc (mad_mem.c:157)
==12657==    by 0x48B7FE7: mad_tpsa_newd (mad_tpsa.c:279)
==12657==    by 0x109242: main (bug.c:28)
==12657==
==12657== Use of uninitialised value of size 8
==12657==    at 0x495C4B3: __mpn_mul_1 (mul_1.S:85)
==12657==    by 0x4963B1D: __printf_fp_l (printf_fp.c:795)
==12657==    by 0x497B3A0: __printf_fp_spec (vfprintf-internal.c:354)
==12657==    by 0x497B3A0: printf_positional (vfprintf-internal.c:1953)
==12657==    by 0x497C335: __vfprintf_internal (vfprintf-internal.c:1602)
==12657==    by 0x4A3BD12: __fprintf_chk (fprintf_chk.c:33)
==12657==    by 0x48B7AFE: UnknownInlinedFun (stdio2.h:105)
==12657==    by 0x48B7AFE: mad_tpsa_debug (mad_tpsa.c:122)
==12657==    by 0x48B8415: mad_tpsa_update (mad_tpsa.c:315)
==12657==    by 0x48C4E58: mad_tpsa_add (mad_tpsa_ops.c:350)
==12657==    by 0x1092AB: main (bug.c:34)
==12657==  Uninitialised value was created by a heap allocation
==12657==    at 0x4848899: malloc (in /usr/libexec/valgrind/vgpreload_memcheck-amd64-linux.so)
==12657==    by 0x4869BCC: mad_malloc (mad_mem.c:157)
==12657==    by 0x48B7FE7: mad_tpsa_newd (mad_tpsa.c:279)
==12657==    by 0x109242: main (bug.c:28)
==12657==
==12657== Use of uninitialised value of size 8
==12657==    at 0x495C522: __mpn_mul_1 (mul_1.S:117)
==12657==    by 0x4963B1D: __printf_fp_l (printf_fp.c:795)
==12657==    by 0x497B3A0: __printf_fp_spec (vfprintf-internal.c:354)
==12657==    by 0x497B3A0: printf_positional (vfprintf-internal.c:1953)
==12657==    by 0x497C335: __vfprintf_internal (vfprintf-internal.c:1602)
==12657==    by 0x4A3BD12: __fprintf_chk (fprintf_chk.c:33)
==12657==    by 0x48B7AFE: UnknownInlinedFun (stdio2.h:105)
==12657==    by 0x48B7AFE: mad_tpsa_debug (mad_tpsa.c:122)
==12657==    by 0x48B8415: mad_tpsa_update (mad_tpsa.c:315)
==12657==    by 0x48C4E58: mad_tpsa_add (mad_tpsa_ops.c:350)
==12657==    by 0x1092AB: main (bug.c:34)
==12657==  Uninitialised value was created by a heap allocation
==12657==    at 0x4848899: malloc (in /usr/libexec/valgrind/vgpreload_memcheck-amd64-linux.so)
==12657==    by 0x4869BCC: mad_malloc (mad_mem.c:157)
==12657==    by 0x48B7FE7: mad_tpsa_newd (mad_tpsa.c:279)
==12657==    by 0x109242: main (bug.c:28)
==12657==
==12657== Use of uninitialised value of size 8
==12657==    at 0x4963B3C: __printf_fp_l (printf_fp.c:799)
==12657==    by 0x497B3A0: __printf_fp_spec (vfprintf-internal.c:354)
==12657==    by 0x497B3A0: printf_positional (vfprintf-internal.c:1953)
==12657==    by 0x497C335: __vfprintf_internal (vfprintf-internal.c:1602)
==12657==    by 0x4A3BD12: __fprintf_chk (fprintf_chk.c:33)
==12657==    by 0x48B7AFE: UnknownInlinedFun (stdio2.h:105)
==12657==    by 0x48B7AFE: mad_tpsa_debug (mad_tpsa.c:122)
==12657==    by 0x48B8415: mad_tpsa_update (mad_tpsa.c:315)
==12657==    by 0x48C4E58: mad_tpsa_add (mad_tpsa_ops.c:350)
==12657==    by 0x1092AB: main (bug.c:34)
==12657==  Uninitialised value was created by a heap allocation
==12657==    at 0x4848899: malloc (in /usr/libexec/valgrind/vgpreload_memcheck-amd64-linux.so)
==12657==    by 0x4869BCC: mad_malloc (mad_mem.c:157)
==12657==    by 0x48B7FE7: mad_tpsa_newd (mad_tpsa.c:279)
==12657==    by 0x109242: main (bug.c:28)
==12657==
==12657== Conditional jump or move depends on uninitialised value(s)
==12657==    at 0x4963B48: __printf_fp_l (printf_fp.c:800)
==12657==    by 0x497B3A0: __printf_fp_spec (vfprintf-internal.c:354)
==12657==    by 0x497B3A0: printf_positional (vfprintf-internal.c:1953)
==12657==    by 0x497C335: __vfprintf_internal (vfprintf-internal.c:1602)
==12657==    by 0x4A3BD12: __fprintf_chk (fprintf_chk.c:33)
==12657==    by 0x48B7AFE: UnknownInlinedFun (stdio2.h:105)
==12657==    by 0x48B7AFE: mad_tpsa_debug (mad_tpsa.c:122)
==12657==    by 0x48B8415: mad_tpsa_update (mad_tpsa.c:315)
==12657==    by 0x48C4E58: mad_tpsa_add (mad_tpsa_ops.c:350)
==12657==    by 0x1092AB: main (bug.c:34)
==12657==  Uninitialised value was created by a heap allocation
==12657==    at 0x4848899: malloc (in /usr/libexec/valgrind/vgpreload_memcheck-amd64-linux.so)
==12657==    by 0x4869BCC: mad_malloc (mad_mem.c:157)
==12657==    by 0x48B7FE7: mad_tpsa_newd (mad_tpsa.c:279)
==12657==    by 0x109242: main (bug.c:28)
==12657==
==12657== Use of uninitialised value of size 8
==12657==    at 0x495BE8C: __mpn_rshift (rshift.S:62)
==12657==    by 0x49640D8: __printf_fp_l (printf_fp.c:808)
==12657==    by 0x497B3A0: __printf_fp_spec (vfprintf-internal.c:354)
==12657==    by 0x497B3A0: printf_positional (vfprintf-internal.c:1953)
==12657==    by 0x497C335: __vfprintf_internal (vfprintf-internal.c:1602)
==12657==    by 0x4A3BD12: __fprintf_chk (fprintf_chk.c:33)
==12657==    by 0x48B7AFE: UnknownInlinedFun (stdio2.h:105)
==12657==    by 0x48B7AFE: mad_tpsa_debug (mad_tpsa.c:122)
==12657==    by 0x48B8415: mad_tpsa_update (mad_tpsa.c:315)
==12657==    by 0x48C4E58: mad_tpsa_add (mad_tpsa_ops.c:350)
==12657==    by 0x1092AB: main (bug.c:34)
==12657==  Uninitialised value was created by a heap allocation
==12657==    at 0x4848899: malloc (in /usr/libexec/valgrind/vgpreload_memcheck-amd64-linux.so)
==12657==    by 0x4869BCC: mad_malloc (mad_mem.c:157)
==12657==    by 0x48B7FE7: mad_tpsa_newd (mad_tpsa.c:279)
==12657==    by 0x109242: main (bug.c:28)
==12657==
==12657== Use of uninitialised value of size 8
==12657==    at 0x495BEB1: __mpn_rshift (rshift.S:73)
==12657==    by 0x49640D8: __printf_fp_l (printf_fp.c:808)
==12657==    by 0x497B3A0: __printf_fp_spec (vfprintf-internal.c:354)
==12657==    by 0x497B3A0: printf_positional (vfprintf-internal.c:1953)
==12657==    by 0x497C335: __vfprintf_internal (vfprintf-internal.c:1602)
==12657==    by 0x4A3BD12: __fprintf_chk (fprintf_chk.c:33)
==12657==    by 0x48B7AFE: UnknownInlinedFun (stdio2.h:105)
==12657==    by 0x48B7AFE: mad_tpsa_debug (mad_tpsa.c:122)
==12657==    by 0x48B8415: mad_tpsa_update (mad_tpsa.c:315)
==12657==    by 0x48C4E58: mad_tpsa_add (mad_tpsa_ops.c:350)
==12657==    by 0x1092AB: main (bug.c:34)
==12657==  Uninitialised value was created by a heap allocation
==12657==    at 0x4848899: malloc (in /usr/libexec/valgrind/vgpreload_memcheck-amd64-linux.so)
==12657==    by 0x4869BCC: mad_malloc (mad_mem.c:157)
==12657==    by 0x48B7FE7: mad_tpsa_newd (mad_tpsa.c:279)
==12657==    by 0x109242: main (bug.c:28)
==12657==
==12657== Use of uninitialised value of size 8
==12657==    at 0x49615B9: hack_digit (printf_fp.c:177)
==12657==    by 0x496265B: __printf_fp_l (printf_fp.c:966)
==12657==    by 0x497B3A0: __printf_fp_spec (vfprintf-internal.c:354)
==12657==    by 0x497B3A0: printf_positional (vfprintf-internal.c:1953)
==12657==    by 0x497C335: __vfprintf_internal (vfprintf-internal.c:1602)
==12657==    by 0x4A3BD12: __fprintf_chk (fprintf_chk.c:33)
==12657==    by 0x48B7AFE: UnknownInlinedFun (stdio2.h:105)
==12657==    by 0x48B7AFE: mad_tpsa_debug (mad_tpsa.c:122)
==12657==    by 0x48B8415: mad_tpsa_update (mad_tpsa.c:315)
==12657==    by 0x48C4E58: mad_tpsa_add (mad_tpsa_ops.c:350)
==12657==    by 0x1092AB: main (bug.c:34)
==12657==  Uninitialised value was created by a heap allocation
==12657==    at 0x4848899: malloc (in /usr/libexec/valgrind/vgpreload_memcheck-amd64-linux.so)
==12657==    by 0x4869BCC: mad_malloc (mad_mem.c:157)
==12657==    by 0x48B7FE7: mad_tpsa_newd (mad_tpsa.c:279)
==12657==    by 0x109242: main (bug.c:28)
==12657==
==12657== Use of uninitialised value of size 8
==12657==    at 0x495C428: __mpn_mul_1 (mul_1.S:36)
==12657==    by 0x49615C0: hack_digit (printf_fp.c:178)
==12657==    by 0x496265B: __printf_fp_l (printf_fp.c:966)
==12657==    by 0x497B3A0: __printf_fp_spec (vfprintf-internal.c:354)
==12657==    by 0x497B3A0: printf_positional (vfprintf-internal.c:1953)
==12657==    by 0x497C335: __vfprintf_internal (vfprintf-internal.c:1602)
==12657==    by 0x4A3BD12: __fprintf_chk (fprintf_chk.c:33)
==12657==    by 0x48B7AFE: UnknownInlinedFun (stdio2.h:105)
==12657==    by 0x48B7AFE: mad_tpsa_debug (mad_tpsa.c:122)
==12657==    by 0x48B8415: mad_tpsa_update (mad_tpsa.c:315)
==12657==    by 0x48C4E58: mad_tpsa_add (mad_tpsa_ops.c:350)
==12657==    by 0x1092AB: main (bug.c:34)
==12657==  Uninitialised value was created by a heap allocation
==12657==    at 0x4848899: malloc (in /usr/libexec/valgrind/vgpreload_memcheck-amd64-linux.so)
==12657==    by 0x4869BCC: mad_malloc (mad_mem.c:157)
==12657==    by 0x48B7FE7: mad_tpsa_newd (mad_tpsa.c:279)
==12657==    by 0x109242: main (bug.c:28)
==12657==
==12657== Use of uninitialised value of size 8
==12657==    at 0x495C44C: __mpn_mul_1 (mul_1.S:52)
==12657==    by 0x49615C0: hack_digit (printf_fp.c:178)
==12657==    by 0x496265B: __printf_fp_l (printf_fp.c:966)
==12657==    by 0x497B3A0: __printf_fp_spec (vfprintf-internal.c:354)
==12657==    by 0x497B3A0: printf_positional (vfprintf-internal.c:1953)
==12657==    by 0x497C335: __vfprintf_internal (vfprintf-internal.c:1602)
==12657==    by 0x4A3BD12: __fprintf_chk (fprintf_chk.c:33)
==12657==    by 0x48B7AFE: UnknownInlinedFun (stdio2.h:105)
==12657==    by 0x48B7AFE: mad_tpsa_debug (mad_tpsa.c:122)
==12657==    by 0x48B8415: mad_tpsa_update (mad_tpsa.c:315)
==12657==    by 0x48C4E58: mad_tpsa_add (mad_tpsa_ops.c:350)
==12657==    by 0x1092AB: main (bug.c:34)
==12657==  Uninitialised value was created by a heap allocation
==12657==    at 0x4848899: malloc (in /usr/libexec/valgrind/vgpreload_memcheck-amd64-linux.so)
==12657==    by 0x4869BCC: mad_malloc (mad_mem.c:157)
==12657==    by 0x48B7FE7: mad_tpsa_newd (mad_tpsa.c:279)
==12657==    by 0x109242: main (bug.c:28)
==12657==
==12657== Conditional jump or move depends on uninitialised value(s)
==12657==    at 0x49629B0: __printf_fp_l (printf_fp.c:978)
==12657==    by 0x497B3A0: __printf_fp_spec (vfprintf-internal.c:354)
==12657==    by 0x497B3A0: printf_positional (vfprintf-internal.c:1953)
==12657==    by 0x497C335: __vfprintf_internal (vfprintf-internal.c:1602)
==12657==    by 0x4A3BD12: __fprintf_chk (fprintf_chk.c:33)
==12657==    by 0x48B7AFE: UnknownInlinedFun (stdio2.h:105)
==12657==    by 0x48B7AFE: mad_tpsa_debug (mad_tpsa.c:122)
==12657==    by 0x48B8415: mad_tpsa_update (mad_tpsa.c:315)
==12657==    by 0x48C4E58: mad_tpsa_add (mad_tpsa_ops.c:350)
==12657==    by 0x1092AB: main (bug.c:34)
==12657==  Uninitialised value was created by a heap allocation
==12657==    at 0x4848899: malloc (in /usr/libexec/valgrind/vgpreload_memcheck-amd64-linux.so)
==12657==    by 0x4869BCC: mad_malloc (mad_mem.c:157)
==12657==    by 0x48B7FE7: mad_tpsa_newd (mad_tpsa.c:279)
==12657==    by 0x109242: main (bug.c:28)
==12657==
==12657== Use of uninitialised value of size 8
==12657==    at 0x49615B9: hack_digit (printf_fp.c:177)
==12657==    by 0x49629CA: __printf_fp_l (printf_fp.c:979)
==12657==    by 0x497B3A0: __printf_fp_spec (vfprintf-internal.c:354)
==12657==    by 0x497B3A0: printf_positional (vfprintf-internal.c:1953)
==12657==    by 0x497C335: __vfprintf_internal (vfprintf-internal.c:1602)
==12657==    by 0x4A3BD12: __fprintf_chk (fprintf_chk.c:33)
==12657==    by 0x48B7AFE: UnknownInlinedFun (stdio2.h:105)
==12657==    by 0x48B7AFE: mad_tpsa_debug (mad_tpsa.c:122)
==12657==    by 0x48B8415: mad_tpsa_update (mad_tpsa.c:315)
==12657==    by 0x48C4E58: mad_tpsa_add (mad_tpsa_ops.c:350)
==12657==    by 0x1092AB: main (bug.c:34)
==12657==  Uninitialised value was created by a heap allocation
==12657==    at 0x4848899: malloc (in /usr/libexec/valgrind/vgpreload_memcheck-amd64-linux.so)
==12657==    by 0x4869BCC: mad_malloc (mad_mem.c:157)
==12657==    by 0x48B7FE7: mad_tpsa_newd (mad_tpsa.c:279)
==12657==    by 0x109242: main (bug.c:28)
==12657==
==12657== Use of uninitialised value of size 8
==12657==    at 0x495C428: __mpn_mul_1 (mul_1.S:36)
==12657==    by 0x49615C0: hack_digit (printf_fp.c:178)
==12657==    by 0x49629CA: __printf_fp_l (printf_fp.c:979)
==12657==    by 0x497B3A0: __printf_fp_spec (vfprintf-internal.c:354)
==12657==    by 0x497B3A0: printf_positional (vfprintf-internal.c:1953)
==12657==    by 0x497C335: __vfprintf_internal (vfprintf-internal.c:1602)
==12657==    by 0x4A3BD12: __fprintf_chk (fprintf_chk.c:33)
==12657==    by 0x48B7AFE: UnknownInlinedFun (stdio2.h:105)
==12657==    by 0x48B7AFE: mad_tpsa_debug (mad_tpsa.c:122)
==12657==    by 0x48B8415: mad_tpsa_update (mad_tpsa.c:315)
==12657==    by 0x48C4E58: mad_tpsa_add (mad_tpsa_ops.c:350)
==12657==    by 0x1092AB: main (bug.c:34)
==12657==  Uninitialised value was created by a heap allocation
==12657==    at 0x4848899: malloc (in /usr/libexec/valgrind/vgpreload_memcheck-amd64-linux.so)
==12657==    by 0x4869BCC: mad_malloc (mad_mem.c:157)
==12657==    by 0x48B7FE7: mad_tpsa_newd (mad_tpsa.c:279)
==12657==    by 0x109242: main (bug.c:28)
==12657==
==12657== Use of uninitialised value of size 8
==12657==    at 0x495C44C: __mpn_mul_1 (mul_1.S:52)
==12657==    by 0x49615C0: hack_digit (printf_fp.c:178)
==12657==    by 0x49629CA: __printf_fp_l (printf_fp.c:979)
==12657==    by 0x497B3A0: __printf_fp_spec (vfprintf-internal.c:354)
==12657==    by 0x497B3A0: printf_positional (vfprintf-internal.c:1953)
==12657==    by 0x497C335: __vfprintf_internal (vfprintf-internal.c:1602)
==12657==    by 0x4A3BD12: __fprintf_chk (fprintf_chk.c:33)
==12657==    by 0x48B7AFE: UnknownInlinedFun (stdio2.h:105)
==12657==    by 0x48B7AFE: mad_tpsa_debug (mad_tpsa.c:122)
==12657==    by 0x48B8415: mad_tpsa_update (mad_tpsa.c:315)
==12657==    by 0x48C4E58: mad_tpsa_add (mad_tpsa_ops.c:350)
==12657==    by 0x1092AB: main (bug.c:34)
==12657==  Uninitialised value was created by a heap allocation
==12657==    at 0x4848899: malloc (in /usr/libexec/valgrind/vgpreload_memcheck-amd64-linux.so)
==12657==    by 0x4869BCC: mad_malloc (mad_mem.c:157)
==12657==    by 0x48B7FE7: mad_tpsa_newd (mad_tpsa.c:279)
==12657==    by 0x109242: main (bug.c:28)
==12657==
==12657== Conditional jump or move depends on uninitialised value(s)
==12657==    at 0x49629EA: __printf_fp_l (printf_fp.c:981)
==12657==    by 0x497B3A0: __printf_fp_spec (vfprintf-internal.c:354)
==12657==    by 0x497B3A0: printf_positional (vfprintf-internal.c:1953)
==12657==    by 0x497C335: __vfprintf_internal (vfprintf-internal.c:1602)
==12657==    by 0x4A3BD12: __fprintf_chk (fprintf_chk.c:33)
==12657==    by 0x48B7AFE: UnknownInlinedFun (stdio2.h:105)
==12657==    by 0x48B7AFE: mad_tpsa_debug (mad_tpsa.c:122)
==12657==    by 0x48B8415: mad_tpsa_update (mad_tpsa.c:315)
==12657==    by 0x48C4E58: mad_tpsa_add (mad_tpsa_ops.c:350)
==12657==    by 0x1092AB: main (bug.c:34)
==12657==  Uninitialised value was created by a heap allocation
==12657==    at 0x4848899: malloc (in /usr/libexec/valgrind/vgpreload_memcheck-amd64-linux.so)
==12657==    by 0x4869BCC: mad_malloc (mad_mem.c:157)
==12657==    by 0x48B7FE7: mad_tpsa_newd (mad_tpsa.c:279)
==12657==    by 0x109242: main (bug.c:28)
==12657==
==12657== Use of uninitialised value of size 8
==12657==    at 0x4962A1E: __printf_fp_l (printf_fp.c:991)
==12657==    by 0x497B3A0: __printf_fp_spec (vfprintf-internal.c:354)
==12657==    by 0x497B3A0: printf_positional (vfprintf-internal.c:1953)
==12657==    by 0x497C335: __vfprintf_internal (vfprintf-internal.c:1602)
==12657==    by 0x4A3BD12: __fprintf_chk (fprintf_chk.c:33)
==12657==    by 0x48B7AFE: UnknownInlinedFun (stdio2.h:105)
==12657==    by 0x48B7AFE: mad_tpsa_debug (mad_tpsa.c:122)
==12657==    by 0x48B8415: mad_tpsa_update (mad_tpsa.c:315)
==12657==    by 0x48C4E58: mad_tpsa_add (mad_tpsa_ops.c:350)
==12657==    by 0x1092AB: main (bug.c:34)
==12657==  Uninitialised value was created by a heap allocation
==12657==    at 0x4848899: malloc (in /usr/libexec/valgrind/vgpreload_memcheck-amd64-linux.so)
==12657==    by 0x4869BCC: mad_malloc (mad_mem.c:157)
==12657==    by 0x48B7FE7: mad_tpsa_newd (mad_tpsa.c:279)
==12657==    by 0x109242: main (bug.c:28)
==12657==
==12657== Conditional jump or move depends on uninitialised value(s)
==12657==    at 0x4962A24: __printf_fp_l (printf_fp.c:991)
==12657==    by 0x497B3A0: __printf_fp_spec (vfprintf-internal.c:354)
==12657==    by 0x497B3A0: printf_positional (vfprintf-internal.c:1953)
==12657==    by 0x497C335: __vfprintf_internal (vfprintf-internal.c:1602)
==12657==    by 0x4A3BD12: __fprintf_chk (fprintf_chk.c:33)
==12657==    by 0x48B7AFE: UnknownInlinedFun (stdio2.h:105)
==12657==    by 0x48B7AFE: mad_tpsa_debug (mad_tpsa.c:122)
==12657==    by 0x48B8415: mad_tpsa_update (mad_tpsa.c:315)
==12657==    by 0x48C4E58: mad_tpsa_add (mad_tpsa_ops.c:350)
==12657==    by 0x1092AB: main (bug.c:34)
==12657==  Uninitialised value was created by a heap allocation
==12657==    at 0x4848899: malloc (in /usr/libexec/valgrind/vgpreload_memcheck-amd64-linux.so)
==12657==    by 0x4869BCC: mad_malloc (mad_mem.c:157)
==12657==    by 0x48B7FE7: mad_tpsa_newd (mad_tpsa.c:279)
==12657==    by 0x109242: main (bug.c:28)
==12657==
==12657== Conditional jump or move depends on uninitialised value(s)
==12657==    at 0x4962A58: round_away (rounding-mode.h:52)
==12657==    by 0x4962A58: __printf_fp_l (printf_fp.c:998)
==12657==    by 0x497B3A0: __printf_fp_spec (vfprintf-internal.c:354)
==12657==    by 0x497B3A0: printf_positional (vfprintf-internal.c:1953)
==12657==    by 0x497C335: __vfprintf_internal (vfprintf-internal.c:1602)
==12657==    by 0x4A3BD12: __fprintf_chk (fprintf_chk.c:33)
==12657==    by 0x48B7AFE: UnknownInlinedFun (stdio2.h:105)
==12657==    by 0x48B7AFE: mad_tpsa_debug (mad_tpsa.c:122)
==12657==    by 0x48B8415: mad_tpsa_update (mad_tpsa.c:315)
==12657==    by 0x48C4E58: mad_tpsa_add (mad_tpsa_ops.c:350)
==12657==    by 0x1092AB: main (bug.c:34)
==12657==  Uninitialised value was created by a heap allocation
==12657==    at 0x4848899: malloc (in /usr/libexec/valgrind/vgpreload_memcheck-amd64-linux.so)
==12657==    by 0x4869BCC: mad_malloc (mad_mem.c:157)
==12657==    by 0x48B7FE7: mad_tpsa_newd (mad_tpsa.c:279)
==12657==    by 0x109242: main (bug.c:28)
==12657==
==12657== Conditional jump or move depends on uninitialised value(s)
==12657==    at 0x4962CD5: __printf_fp_l (printf_fp.c:1166)
==12657==    by 0x497B3A0: __printf_fp_spec (vfprintf-internal.c:354)
==12657==    by 0x497B3A0: printf_positional (vfprintf-internal.c:1953)
==12657==    by 0x497C335: __vfprintf_internal (vfprintf-internal.c:1602)
==12657==    by 0x4A3BD12: __fprintf_chk (fprintf_chk.c:33)
==12657==    by 0x48B7AFE: UnknownInlinedFun (stdio2.h:105)
==12657==    by 0x48B7AFE: mad_tpsa_debug (mad_tpsa.c:122)
==12657==    by 0x48B8415: mad_tpsa_update (mad_tpsa.c:315)
==12657==    by 0x48C4E58: mad_tpsa_add (mad_tpsa_ops.c:350)
==12657==    by 0x1092AB: main (bug.c:34)
==12657==  Uninitialised value was created by a heap allocation
==12657==    at 0x4848899: malloc (in /usr/libexec/valgrind/vgpreload_memcheck-amd64-linux.so)
==12657==    by 0x4869BCC: mad_malloc (mad_mem.c:157)
==12657==    by 0x48B7FE7: mad_tpsa_newd (mad_tpsa.c:279)
==12657==    by 0x109242: main (bug.c:28)
==12657==
==12657== Conditional jump or move depends on uninitialised value(s)
==12657==    at 0x4962F15: __printf_fp_l (printf_fp.c:1228)
==12657==    by 0x497B3A0: __printf_fp_spec (vfprintf-internal.c:354)
==12657==    by 0x497B3A0: printf_positional (vfprintf-internal.c:1953)
==12657==    by 0x497C335: __vfprintf_internal (vfprintf-internal.c:1602)
==12657==    by 0x4A3BD12: __fprintf_chk (fprintf_chk.c:33)
==12657==    by 0x48B7AFE: UnknownInlinedFun (stdio2.h:105)
==12657==    by 0x48B7AFE: mad_tpsa_debug (mad_tpsa.c:122)
==12657==    by 0x48B8415: mad_tpsa_update (mad_tpsa.c:315)
==12657==    by 0x48C4E58: mad_tpsa_add (mad_tpsa_ops.c:350)
==12657==    by 0x1092AB: main (bug.c:34)
==12657==  Uninitialised value was created by a heap allocation
==12657==    at 0x4848899: malloc (in /usr/libexec/valgrind/vgpreload_memcheck-amd64-linux.so)
==12657==    by 0x4869BCC: mad_malloc (mad_mem.c:157)
==12657==    by 0x48B7FE7: mad_tpsa_newd (mad_tpsa.c:279)
==12657==    by 0x109242: main (bug.c:28)
==12657==
==12657== Conditional jump or move depends on uninitialised value(s)
==12657==    at 0x4962EFB: __printf_fp_l (printf_fp.c:1230)
==12657==    by 0x497B3A0: __printf_fp_spec (vfprintf-internal.c:354)
==12657==    by 0x497B3A0: printf_positional (vfprintf-internal.c:1953)
==12657==    by 0x497C335: __vfprintf_internal (vfprintf-internal.c:1602)
==12657==    by 0x4A3BD12: __fprintf_chk (fprintf_chk.c:33)
==12657==    by 0x48B7AFE: UnknownInlinedFun (stdio2.h:105)
==12657==    by 0x48B7AFE: mad_tpsa_debug (mad_tpsa.c:122)
==12657==    by 0x48B8415: mad_tpsa_update (mad_tpsa.c:315)
==12657==    by 0x48C4E58: mad_tpsa_add (mad_tpsa_ops.c:350)
==12657==    by 0x1092AB: main (bug.c:34)
==12657==  Uninitialised value was created by a heap allocation
==12657==    at 0x4848899: malloc (in /usr/libexec/valgrind/vgpreload_memcheck-amd64-linux.so)
==12657==    by 0x4869BCC: mad_malloc (mad_mem.c:157)
==12657==    by 0x48B7FE7: mad_tpsa_newd (mad_tpsa.c:279)
==12657==    by 0x109242: main (bug.c:28)
==12657==
==12657== Conditional jump or move depends on uninitialised value(s)
==12657==    at 0x4993E1D: _IO_file_overflow@@GLIBC_2.2.5 (fileops.c:782)
==12657==    by 0x4963801: __printf_fp_l (printf_fp.c:1254)
==12657==    by 0x497B3A0: __printf_fp_spec (vfprintf-internal.c:354)
==12657==    by 0x497B3A0: printf_positional (vfprintf-internal.c:1953)
==12657==    by 0x497C335: __vfprintf_internal (vfprintf-internal.c:1602)
==12657==    by 0x4A3BD12: __fprintf_chk (fprintf_chk.c:33)
==12657==    by 0x48B7AFE: UnknownInlinedFun (stdio2.h:105)
==12657==    by 0x48B7AFE: mad_tpsa_debug (mad_tpsa.c:122)
==12657==    by 0x48B8415: mad_tpsa_update (mad_tpsa.c:315)
==12657==    by 0x48C4E58: mad_tpsa_add (mad_tpsa_ops.c:350)
==12657==    by 0x1092AB: main (bug.c:34)
==12657==  Uninitialised value was created by a heap allocation
==12657==    at 0x4848899: malloc (in /usr/libexec/valgrind/vgpreload_memcheck-amd64-linux.so)
==12657==    by 0x4869BCC: mad_malloc (mad_mem.c:157)
==12657==    by 0x48B7FE7: mad_tpsa_newd (mad_tpsa.c:279)
==12657==    by 0x109242: main (bug.c:28)
==12657==
==12657== Syscall param write(buf) points to uninitialised byte(s)
==12657==    at 0x4A1B887: write (write.c:26)
==12657==    by 0x4991EEC: _IO_file_write@@GLIBC_2.2.5 (fileops.c:1180)
==12657==    by 0x49939E0: new_do_write (fileops.c:448)
==12657==    by 0x49939E0: _IO_new_do_write (fileops.c:425)
==12657==    by 0x49939E0: _IO_do_write@@GLIBC_2.2.5 (fileops.c:422)
==12657==    by 0x49926D4: _IO_new_file_xsputn (fileops.c:1243)
==12657==    by 0x49926D4: _IO_file_xsputn@@GLIBC_2.2.5 (fileops.c:1196)
==12657==    by 0x497A71C: outstring_func (vfprintf-internal.c:239)
==12657==    by 0x497A71C: printf_positional (vfprintf-internal.c:1995)
==12657==    by 0x497C335: __vfprintf_internal (vfprintf-internal.c:1602)
==12657==    by 0x4A3BD12: __fprintf_chk (fprintf_chk.c:33)
==12657==    by 0x48B7AFE: UnknownInlinedFun (stdio2.h:105)
==12657==    by 0x48B7AFE: mad_tpsa_debug (mad_tpsa.c:122)
==12657==    by 0x48B8415: mad_tpsa_update (mad_tpsa.c:315)
==12657==    by 0x48C4E58: mad_tpsa_add (mad_tpsa_ops.c:350)
==12657==    by 0x1092AB: main (bug.c:34)
==12657==  Address 0x5745057 is 71 bytes inside a block of size 1,024 alloc'd
==12657==    at 0x4848899: malloc (in /usr/libexec/valgrind/vgpreload_memcheck-amd64-linux.so)
==12657==    by 0x4985BA3: _IO_file_doallocate (filedoalloc.c:101)
==12657==    by 0x4994CDF: _IO_doallocbuf (genops.c:347)
==12657==    by 0x4993F5F: _IO_file_overflow@@GLIBC_2.2.5 (fileops.c:744)
==12657==    by 0x49926D4: _IO_new_file_xsputn (fileops.c:1243)
==12657==    by 0x49926D4: _IO_file_xsputn@@GLIBC_2.2.5 (fileops.c:1196)
==12657==    by 0x497C14C: outstring_func (vfprintf-internal.c:239)
==12657==    by 0x497C14C: __vfprintf_internal (vfprintf-internal.c:1263)
==12657==    by 0x4A3BC4A: __printf_chk (printf_chk.c:33)
==12657==    by 0x48B806E: UnknownInlinedFun (stdio2.h:112)
==12657==    by 0x48B806E: mad_tpsa_newd (mad_tpsa.c:277)
==12657==    by 0x109230: main (bug.c:27)
==12657==  Uninitialised value was created by a heap allocation
==12657==    at 0x4848899: malloc (in /usr/libexec/valgrind/vgpreload_memcheck-amd64-linux.so)
==12657==    by 0x4869BCC: mad_malloc (mad_mem.c:157)
==12657==    by 0x48B7FE7: mad_tpsa_newd (mad_tpsa.c:279)
==12657==    by 0x109242: main (bug.c:28)
==12657==
mad_tpsa_update:315: 't' { lo=1 hi=10 mo=10(255) ao=10 uid=0 did=0 r=0.20 } 0x0x57455d8
-> mad_tpsa_print:394:

 t       :  R, NV =   1, MO = 10
 *******************************************************
     I   COEFFICIENT             ORDER   EXPONENTS
==12657== Conditional jump or move depends on uninitialised value(s)
==12657==    at 0x48C35CA: mad_tpsa_print (mad_tpsa_io.c:428)
==12657==    by 0x48B7B43: mad_tpsa_debug (mad_tpsa.c:126)
==12657==    by 0x48B8415: mad_tpsa_update (mad_tpsa.c:315)
==12657==    by 0x48C4E58: mad_tpsa_add (mad_tpsa_ops.c:350)
==12657==    by 0x1092AB: main (bug.c:34)
==12657==  Uninitialised value was created by a heap allocation
==12657==    at 0x4848899: malloc (in /usr/libexec/valgrind/vgpreload_memcheck-amd64-linux.so)
==12657==    by 0x4869BCC: mad_malloc (mad_mem.c:157)
==12657==    by 0x48B7FE7: mad_tpsa_newd (mad_tpsa.c:279)
==12657==    by 0x109242: main (bug.c:28)
==12657==
     1   1.0000000000000000E+00    1     1
     2   1.0000000000000000E+00   10     10
<- mad_tpsa_print:441:
<- mad_tpsa_update:315:
<- mad_tpsa_add:352:
-> mad_tpsa_cycle:460:
<- mad_tpsa_cycle:470:
 1.0000000000000000e+00  [1]
-> mad_tpsa_cycle:460:
==12657== Conditional jump or move depends on uninitialised value(s)
==12657==    at 0x48B672D: mad_tpsa_cycle (mad_tpsa.c:464)
==12657==    by 0x10930D: UnknownInlinedFun (bug.c:12)
==12657==    by 0x10930D: main (bug.c:36)
==12657==  Uninitialised value was created by a heap allocation
==12657==    at 0x4848899: malloc (in /usr/libexec/valgrind/vgpreload_memcheck-amd64-linux.so)
==12657==    by 0x4869BCC: mad_malloc (mad_mem.c:157)
==12657==    by 0x48B7FE7: mad_tpsa_newd (mad_tpsa.c:279)
==12657==    by 0x109242: main (bug.c:28)
==12657==
<- mad_tpsa_cycle:470:
 1.0000000000000000e+00  [10]
-> mad_tpsa_cycle:460:
<- mad_tpsa_cycle:465:
-> mad_tpsa_print:394:

 y       :  R, NV =   1, MO = 10
 *******************************************************
     I   COEFFICIENT             ORDER   EXPONENTS
     1   0.0000000000000000E+00    0     0
     2   1.0000000000000000E+00    1     1
<- mad_tpsa_print:441:
-> mad_tpsa_print:394:

 x       :  R, NV =   1, MO = 10
 *******************************************************
     I   COEFFICIENT             ORDER   EXPONENTS
     1   0.0000000000000000E+00    0     0
     2   1.0000000000000000E+00   10     10
<- mad_tpsa_print:441:
-> mad_tpsa_print:394:

 z       :  R, NV =   1, MO = 10
 *******************************************************
     I   COEFFICIENT             ORDER   EXPONENTS
     1   0.0000000000000000E+00    0     0
==12657== Conditional jump or move depends on uninitialised value(s)
==12657==    at 0x48C35CA: mad_tpsa_print (mad_tpsa_io.c:428)
==12657==    by 0x109362: main (bug.c:40)
==12657==  Uninitialised value was created by a heap allocation
==12657==    at 0x4848899: malloc (in /usr/libexec/valgrind/vgpreload_memcheck-amd64-linux.so)
==12657==    by 0x4869BCC: mad_malloc (mad_mem.c:157)
==12657==    by 0x48B7FE7: mad_tpsa_newd (mad_tpsa.c:279)
==12657==    by 0x109242: main (bug.c:28)
==12657==
     2   1.0000000000000000E+00    1     1
==12657== Conditional jump or move depends on uninitialised value(s)
==12657==    at 0x495D50F: __mpn_extract_double (dbl2mpn.c:60)
==12657==    by 0x4961FCE: __printf_fp_l (printf_fp.c:396)
==12657==    by 0x497B3A0: __printf_fp_spec (vfprintf-internal.c:354)
==12657==    by 0x497B3A0: printf_positional (vfprintf-internal.c:1953)
==12657==    by 0x497C335: __vfprintf_internal (vfprintf-internal.c:1602)
==12657==    by 0x4A3BD12: __fprintf_chk (fprintf_chk.c:33)
==12657==    by 0x48C360B: UnknownInlinedFun (stdio2.h:105)
==12657==    by 0x48C360B: mad_tpsa_print (mad_tpsa_io.c:430)
==12657==    by 0x109362: main (bug.c:40)
==12657==  Uninitialised value was created by a heap allocation
==12657==    at 0x4848899: malloc (in /usr/libexec/valgrind/vgpreload_memcheck-amd64-linux.so)
==12657==    by 0x4869BCC: mad_malloc (mad_mem.c:157)
==12657==    by 0x48B7FE7: mad_tpsa_newd (mad_tpsa.c:279)
==12657==    by 0x109242: main (bug.c:28)
==12657==
==12657== Conditional jump or move depends on uninitialised value(s)
==12657==    at 0x4962CCC: __printf_fp_l (printf_fp.c:1166)
==12657==    by 0x497B3A0: __printf_fp_spec (vfprintf-internal.c:354)
==12657==    by 0x497B3A0: printf_positional (vfprintf-internal.c:1953)
==12657==    by 0x497C335: __vfprintf_internal (vfprintf-internal.c:1602)
==12657==    by 0x4A3BD12: __fprintf_chk (fprintf_chk.c:33)
==12657==    by 0x48C360B: UnknownInlinedFun (stdio2.h:105)
==12657==    by 0x48C360B: mad_tpsa_print (mad_tpsa_io.c:430)
==12657==    by 0x109362: main (bug.c:40)
==12657==  Uninitialised value was created by a heap allocation
==12657==    at 0x4848899: malloc (in /usr/libexec/valgrind/vgpreload_memcheck-amd64-linux.so)
==12657==    by 0x4869BCC: mad_malloc (mad_mem.c:157)
==12657==    by 0x48B7FE7: mad_tpsa_newd (mad_tpsa.c:279)
==12657==    by 0x109242: main (bug.c:28)
==12657==
==12657== Conditional jump or move depends on uninitialised value(s)
==12657==    at 0x4962D4B: __printf_fp_l (printf_fp.c:1173)
==12657==    by 0x497B3A0: __printf_fp_spec (vfprintf-internal.c:354)
==12657==    by 0x497B3A0: printf_positional (vfprintf-internal.c:1953)
==12657==    by 0x497C335: __vfprintf_internal (vfprintf-internal.c:1602)
==12657==    by 0x4A3BD12: __fprintf_chk (fprintf_chk.c:33)
==12657==    by 0x48C360B: UnknownInlinedFun (stdio2.h:105)
==12657==    by 0x48C360B: mad_tpsa_print (mad_tpsa_io.c:430)
==12657==    by 0x109362: main (bug.c:40)
==12657==  Uninitialised value was created by a heap allocation
==12657==    at 0x4848899: malloc (in /usr/libexec/valgrind/vgpreload_memcheck-amd64-linux.so)
==12657==    by 0x4869BCC: mad_malloc (mad_mem.c:157)
==12657==    by 0x48B7FE7: mad_tpsa_newd (mad_tpsa.c:279)
==12657==    by 0x109242: main (bug.c:28)
==12657==
==12657== Conditional jump or move depends on uninitialised value(s)
==12657==    at 0x4992737: _IO_new_file_xsputn (fileops.c:1218)
==12657==    by 0x4992737: _IO_file_xsputn@@GLIBC_2.2.5 (fileops.c:1196)
==12657==    by 0x4962FAF: __printf_fp_l (printf_fp.c:1254)
==12657==    by 0x497B3A0: __printf_fp_spec (vfprintf-internal.c:354)
==12657==    by 0x497B3A0: printf_positional (vfprintf-internal.c:1953)
==12657==    by 0x497C335: __vfprintf_internal (vfprintf-internal.c:1602)
==12657==    by 0x4A3BD12: __fprintf_chk (fprintf_chk.c:33)
==12657==    by 0x48C360B: UnknownInlinedFun (stdio2.h:105)
==12657==    by 0x48C360B: mad_tpsa_print (mad_tpsa_io.c:430)
==12657==    by 0x109362: main (bug.c:40)
==12657==  Uninitialised value was created by a heap allocation
==12657==    at 0x4848899: malloc (in /usr/libexec/valgrind/vgpreload_memcheck-amd64-linux.so)
==12657==    by 0x4869BCC: mad_malloc (mad_mem.c:157)
==12657==    by 0x48B7FE7: mad_tpsa_newd (mad_tpsa.c:279)
==12657==    by 0x109242: main (bug.c:28)
==12657==
     3   0.0000000000000000E+00    2     2
     4   0.0000000000000000E+00    3     3
     5   0.0000000000000000E+00    4     4
     6   0.0000000000000000E+00    5     5
     7   0.0000000000000000E+00    6     6
     8   0.0000000000000000E+00    7     7
     9   0.0000000000000000E+00    8     8
    10   0.0000000000000000E+00    9     9
    11   1.0000000000000000E+00   10     10
<- mad_tpsa_print:441:
-> mad_tpsa_del:294:
<- mad_tpsa_del:296:
-> mad_tpsa_del:294:
<- mad_tpsa_del:296:
-> mad_tpsa_del:294:
<- mad_tpsa_del:296:
-> mad_desc_del:1328:
<- mad_desc_del:1378:
==12657==
==12657== HEAP SUMMARY:
==12657==     in use at exit: 3,744 bytes in 94 blocks
==12657==   total heap usage: 117 allocs, 23 frees, 18,376 bytes allocated
==12657==
==12657== LEAK SUMMARY:
==12657==    definitely lost: 0 bytes in 0 blocks
==12657==    indirectly lost: 0 bytes in 0 blocks
==12657==      possibly lost: 0 bytes in 0 blocks
==12657==    still reachable: 3,744 bytes in 94 blocks
==12657==         suppressed: 0 bytes in 0 blocks
==12657== Rerun with --leak-check=full to see details of leaked memory
==12657==
==12657== For lists of detected and suppressed errors, rerun with: -s
==12657== ERROR SUMMARY: 578 errors from 52 contexts (suppressed: 0 from 0)
ldeniau commented 5 months ago

I couldn't reproduce the problem and Valgrind does not report the problem either (it is confused by inlined functions apparently).

So I decided to initialize explicitly the memory of the tpsa with values of pi to reproduce your garbage, and then I could see the problem! The output below shows plenty of pi where zeros are expected.

The loops executed in the inlined function axpbypc in mad_tpsa_ops.c are the one with tagged * and in your example, the last one override the zero-initialisation of the second...

I will fix this today.

   const idx_t *o2i = c->d->ord2idx;
*  TPSA_SCAN_I(c,alo,MIN(ahi,blo-1)) c->coef[i] = c1*a->coef[i];
*  TPSA_SCAN_I(c,ahi+1,      blo-1 ) c->coef[i] = 0; // no overlap
   TPSA_SCAN_I(c,blo,MIN(ahi,bhi)  ) c->coef[i] = c1*a->coef[i]+c2*b->coef[i];
   TPSA_SCAN_I(c,bhi+1,  ahi       ) c->coef[i] = c1*a->coef[i];
*  TPSA_SCAN_I(c,ahi+1,      bhi   ) c->coef[i] = c2*b->coef[i];

OUTPUT

-> mad_tpsa_add:343:
alo=1[1], ahi=1[1], blo=10[10], bhi=10[10], clo=1, chi=10
c1=+1.0000E+00, c2=+1.0000E+00, c3=+0.0000E+00
aaa=0x0x600003540008, bbb=0x0x600003540088, ccc=0x0x600003540108
-> mad_tpsa_print:394:

 aaa     :  R, NV =   1, MO = 10
 *******************************************************
     I   COEFFICIENT             ORDER   EXPONENTS
     1   0.0000000000000000E+00    0     0
     2   1.0000000000000000E+00    1     1
<- mad_tpsa_print:441:
-> mad_tpsa_print:394:

 bbb     :  R, NV =   1, MO = 10
 *******************************************************
     I   COEFFICIENT             ORDER   EXPONENTS
     1   0.0000000000000000E+00    0     0
     2   1.0000000000000000E+00   10     10
<- mad_tpsa_print:441:
-> mad_tpsa_print:394:

 ccc     :  R, NV =   1, MO = 10
 *******************************************************
     I   COEFFICIENT             ORDER   EXPONENTS
     1   0.0000000000000000E+00    0     0
     2   1.0000000000000000E+00    1     1
     3   3.1415926535897931E+00    2     2
     4   3.1415926535897931E+00    3     3
     5   3.1415926535897931E+00    4     4
     6   3.1415926535897931E+00    5     5
     7   3.1415926535897931E+00    6     6
     8   3.1415926535897931E+00    7     7
     9   3.1415926535897931E+00    8     8
    10   3.1415926535897931E+00    9     9
    11   1.0000000000000000E+00   10     10
<- mad_tpsa_print:441:
axpbypc:316: 'a' { lo=1 hi=1 mo=10(255) ao=10 uid=0 did=0 r=1.00 } 0x0x600003540008
-> mad_tpsa_print:394:

 a       :  R, NV =   1, MO = 10
 *******************************************************
     I   COEFFICIENT             ORDER   EXPONENTS
     1   1.0000000000000000E+00    1     1
<- mad_tpsa_print:441:
axpbypc:317: 'b' { lo=10 hi=10 mo=10(255) ao=10 uid=0 did=0 r=1.00 } 0x0x600003540088
-> mad_tpsa_print:394:

 b       :  R, NV =   1, MO = 10
 *******************************************************
     I   COEFFICIENT             ORDER   EXPONENTS
     1   1.0000000000000000E+00   10     10
<- mad_tpsa_print:441:
-> mad_tpsa_update:315:
mad_tpsa_update:318: 't' { lo=1 hi=10 mo=10(255) ao=10 uid=0 did=0 r=1.00 } 0x0x600003540108
-> mad_tpsa_print:394:

 t       :  R, NV =   1, MO = 10
 *******************************************************
     I   COEFFICIENT             ORDER   EXPONENTS
     1   1.0000000000000000E+00    1     1
     2   3.1415926535897931E+00    2     2
     3   3.1415926535897931E+00    3     3
     4   3.1415926535897931E+00    4     4
     5   3.1415926535897931E+00    5     5
     6   3.1415926535897931E+00    6     6
     7   3.1415926535897931E+00    7     7
     8   3.1415926535897931E+00    8     8
     9   3.1415926535897931E+00    9     9
    10   1.0000000000000000E+00   10     10
<- mad_tpsa_print:441:
<- mad_tpsa_update:318:
<- mad_tpsa_add:352:
ldeniau commented 5 months ago

fixed in #f240c2c7 we finally converged... thank you for your feedback!

mattsignorelli commented 5 months ago

@ldeniau while I'm not seeing the junk anymore, I'm still getting a heap corruption after doing many operations using GTPSAs. I will try to produce a minimal working example but the program bombs in different places in the same code for different runs so it might be tricky

ldeniau commented 5 months ago

new fix in #ecb0721f (bug in getv found by Antonino unit tests)

mattsignorelli commented 5 months ago

Unfortunately I still have this problem with the latest, there is some kind of memory corruption occurring

ldeniau commented 5 months ago

It would be easier to investigate with an example since RDTs on large machines are working fine for me and involve 80% of the lib functions and millions of TPSA calculations... Functions that are affected by the change of the low-level semantic of the new version and that have been rewritten in depth are geti/seti, getv/setv, axpbypc. Mul, deriv, scan and print have been adapted too. Knowing which functions are used extensively may help to figure out the problem.

Another point that comes to my mind is mad_tpsa_init, do you use it? It's a quite dangerous function useful when TPSA memory is allocated outside C, but the maximum order and the allocated space must match...

mattsignorelli commented 5 months ago

No I don't use init . I am getting closer to narrowing down the functions so I'll let you know soon. I even get the error from GTPSA sometimes at /mad_mem.c:176: ensure(mbp->mark == MARK, "invalid or corrupted allocated memory");

ldeniau commented 5 months ago

Very good, the mad_mem.c error means that some write op occurs outside the allocated memory, typically with an index < 0.

mattsignorelli commented 5 months ago

Yes, it crashes with seg faults too sometimes. Somewhere there is some indexing outside of the allocated memory

mattsignorelli commented 5 months ago

OK I've got it narrowed down- the corruption isn't occurring from tpsa operations, but from descriptor constructions.

All I need to do is create the following two descriptors

NV=3, MO=5, NO= 1 2 3 followed by creating NV=3, MO=6, NO=1 2 3

and then there is corruption (no tpsa's created). So presumably this is related to the new feature of looking up compatible descriptors (same no)

ldeniau commented 5 months ago

OK I've got it narrowed down- the corruption isn't occurring from tpsa operations, but from descriptor constructions.

All I need to do is create the following two descriptors

NV=3, MO=5, NO= 1 2 3 followed by creating NV=3, MO=6, NO=1 2 3

and then there is corruption (no tpsa's created).

what do you mean by no tpsa's created? you don't need to create tpsa to see corruption or you can't create a new tpsa?

So presumably this is related to the new feature of looking up compatible descriptors (same no)

yes, very likely...

mattsignorelli commented 5 months ago

what do you mean by no tpsa's created? you don't need to create tpsa to see corruption or you can't create a new tpsa?

I don't need to create any tpsas. In the Julia if I just create those two descriptors in that order, it will report the memory corruption. If I do it in the opposite order (MO=6 first), then no corruption is reported. So it may likely be related to the new descriptor having an MO higher than the first

ldeniau commented 5 months ago

you are right, and descriptors cannot share the tables dealing with monomials as they are ordered by variables, not by homogeneous polynomials... I have to think a bit more about the implication of sharing tables, aka descriptors compatibility... Compatibility of TPSA should not be affected as they never use these tables, they are only used by my special indexing function and other internal constructions. Many thanks for pointing out the problem...

ldeniau commented 5 months ago

So the problem of sharing descriptors is far more complex than expected because first mo can be higher than max(no[1..nn]) and second po can be higher than max(no[nv+1..nv+np]) and mo. It is possible to share descriptors when everything equals but np_new >= np_old and mo >= po, meaning that tpsas will be oversized and will do more calculations than needed because some monomials become inaccessible (see below). Then the idea would be to add an option to share or not to avoid oversized tpsas... But I think that it's better and cleaner to not share descriptors and to use convert to build proper new damap.

d1 = MAD.gtpsad{nv=6,np=0,mo=3,no={2,2,2,1,1,1}}
d1p= MAD.gtpsad{nv=3,np=3,mo=3,no={2,2,2,1,1,1}} -- shared with d1

    nxtbyord        nxtbyvar 
    d1      d1p     d1      d1p

 0  000000  000000  000000  000000
 1  100000  100000  100000  100000    
 2  010000  010000  200000  200000    
 3  001000  001000  010000  010000    
 4  000100  000100  110000  110000    
 5  000010  000010  210000  210000    
 6  000001  000001  020000  020000    
 7  200000  200000  120000  120000    
 8  110000  110000  001000  001000    
 9  020000  020000  101000  101000    
10  101000  101000  201000  201000    
11  011000  011000  011000  011000    
12  002000  002000  111000  111000    
13  100100  100100  021000  021000    
14  010100  010100  002000  002000    
15  001100  001100  102000  102000    
16  100010  100010  012000  012000    
17  010010  010010  000100  000100    
18  001010  001010  100100  100100    
19  000110  100001  200100  200100  
20  100001  010001  010100  010100  
21  010001  001001  110100  110100  
22  001001  210000  020100  020100  
23  000101  120000  001100  001100  
24  000011  201000  101100  101100  
25  210000  111000  011100  011100  
26  120000  021000  002100  002100  
27  201000  102000  000010  000010  
28  111000  012000  100010  100010  
29  021000  200100  200010  200010  
30  102000  110100  010010  010010  
31  012000  020100  110010  110010  
32  200100  101100  020010  020010  
33  110100  011100  001010  001010  
34  020100  002100  101010  101010  
35  101100  200010  011010  011010  
36  011100  110010  002010  002010  
37  002100  020010  000110  000001  
38  200010  101010  100110  100001  
39  110010  011010  010110  200001  
40  020010  002010  001110  010001  
41  101010  200001  000001  110001  
42  011010  110001  100001  020001  
43  002010  020001  200001  001001  
44  100110  101001  010001  101001  
45  010110  011001  110001  011001  
46  001110  002001  020001  002001  
47  200001          001001  
48  110001          101001  
49  020001          011001  
50  101001          002001  
51  011001          000101  
52  002001          100101  
53  100101          010101  
54  010101          001101  
55  001101          000011  
56  100011          100011  
57  010011          010011  
58  001011          001011  
59  000111          000111  
ldeniau commented 5 months ago

fixed in #cb3b9a93, disable desc sharing...