Commit 959f0be
committed
Initialise f3's locals in ActivityReverse.
f3 declared `double x1, x2, x3, x4, x5 = 0;`, leaving x1..x4 uninitialised,
and looped on `while (!x3)`. The expected gradient {0.00} only holds when
that loop does not run, which relied on the indeterminate x3 happening to
be nonzero -- undefined behaviour Valgrind reports as a conditional jump
on an uninitialised value in the executed f3_grad.
Initialise the locals with x3 nonzero so the loop is deterministically
skipped and x stays inactive, preserving the checked result. Update the
reproduced declaration in the CHECK block and drop the XFAIL: valgrind.1 parent df61a9a commit 959f0be
1 file changed
Lines changed: 5 additions & 4 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2 | 2 | | |
3 | 3 | | |
4 | 4 | | |
5 | | - | |
6 | | - | |
7 | 5 | | |
8 | 6 | | |
9 | 7 | | |
| |||
86 | 84 | | |
87 | 85 | | |
88 | 86 | | |
89 | | - | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
90 | 91 | | |
91 | 92 | | |
92 | 93 | | |
| |||
104 | 105 | | |
105 | 106 | | |
106 | 107 | | |
107 | | - | |
| 108 | + | |
108 | 109 | | |
109 | 110 | | |
110 | 111 | | |
| |||
0 commit comments