<html>
<head>
<meta content="text/html; charset=ISO-8859-1"
http-equiv="Content-Type">
</head>
<body bgcolor="#FFFFFF" text="#000000">
<div class="moz-cite-prefix">Glad to hear you've made progress.<br>
(btw the -g flag should also go on the link line, not just the
compile line)<br>
<br>
I don't know where to go from here. I monitor the ADOL-C list,
but I do<br>
not use ADOL_C (even though I think it is a great package!). An
ADOLC<br>
expert will be able to tell you whether the behaviour is wrong, or
explain<br>
why it has been implemented this way.<br>
<br>
Good luck!<br>
<br>
<br>
On 08/12/2013 05:41 AM, Nozomu Tomita wrote:<br>
</div>
<blockquote
cite="mid:8927A5B6-3E38-42F0-82C2-9F9D2B5F135A@gmail.com"
type="cite">
<meta http-equiv="Content-Type" content="text/html;
charset=ISO-8859-1">
<div>Hello,</div>
<div><br>
</div>
<div>Thank you very much.</div>
<div>I tried to do that, and I think I found where overwriting
occurs.</div>
<div><br>
</div>
<div>By compiling this code (modified for debugging) <a
moz-do-not-send="true" href="http://pastebin.ca/2430971">http://pastebin.ca/2430971</a></div>
<div>with</div>
<div>
<div>$ g++ -g -Wall -c -O0 -I${HOME}/adolc_base/include
adolc_test.cc</div>
<div>$ g++ adolc_test.o ${HOME}/adolc_base/lib64/libadolc.a </div>
</div>
<div>and</div>
<div>$ gdb a.out</div>
<div>and to copy & paste commands <a moz-do-not-send="true"
href="http://pastebin.ca/2430973">http://pastebin.ca/2430973</a> ,
gdb should go the place of the problem,</div>
<div> "adub operator * ( const badouble& x, const
badouble& y )" at line 1001 in adouble.cc.</div>
<div> (I tested in my three environment that this gdb commands
works)</div>
<div>The tail of gdb output is like this: <a
moz-do-not-send="true" href="http://pastebin.ca/2430974">http://pastebin.ca/2430975</a> (this
is in Debian).</div>
<div>From this place, doing "n" gdb command several times changes
what I declared as const.</div>
<div><br>
</div>
<div>This seems to me that, variable "a" and "b" in my code is
stored at index 5 and 4 respectively, in global
array "globalTapeVars.store" inside ADOL-C.</div>
<div>By several "n" command above, changes
"globalTapeVars.store[4]", namely "b".</div>
<div>The problem seems to be in "next_loc()" function.</div>
<div>As argument x and y (for "adub operator *") are declared as
const, it seems next_loc() should</div>
<div>return a place that is different from both x's and y's, but
in this case it returns the place same as x, and</div>
<div>consequently x is overwritten.</div>
<div><br>
</div>
<div>(The tail of gdb output at this point is <a
moz-do-not-send="true" href="http://pastebin.ca/2430984">http://pastebin.ca/2430984</a>
(Debian).</div>
<div>please compare globalTapeVars.store[4] at the top and at the
bottom,</div>
<div>and locations of variables x, y, locat at line 5,7,135.)</div>
<div><br>
</div>
<div>Regards,</div>
<div>Tomita</div>
<div><br>
</div>
<div>On 2013/08/12, at 16:35, Norman Goldstein <<a
moz-do-not-send="true" href="mailto:normvcr@telus.net">normvcr@telus.net</a>>
wrote:</div>
<div><br class="Apple-interchange-newline">
<blockquote type="cite">That's a nice, clean, valgrind run.<br>
Something next to consider trying is in your debugger,<br>
to put a "change" watch on the variable location<br>
that should be const. You can set it to break<br>
when the memory location changes value, and<br>
then you can hopefully see who the culprit is.<br>
<br>
<br>
On 08/11/2013 10:35 PM, Nozomu Tomita wrote:<br>
<blockquote type="cite">Dear all,<br>
<br>
Thank you for the quick reply.<br>
I tried valgrind, but (if my usage is correct) it found no
error.<br>
(as I didn't use "new" or "[]" operator, I guess this is not
from memory handling in this code)<br>
<br>
I could reduce my previous code...: <a
moz-do-not-send="true" href="http://pastebin.ca/2430872">http://pastebin.ca/2430872</a>
,<br>
and its output is this: <a moz-do-not-send="true"
href="http://pastebin.ca/2430873">http://pastebin.ca/2430873</a>
.<br>
<br>
This code does a multiplication with a template class
"wrap", for double and adouble.<br>
Line 15-18 of the output corresponds to line 25-34 of the
source, with D == adouble.<br>
Here a and b changes after multiplication, in spite of its
type "wrap<const adouble>"<br>
(consequently its member is of type "const adouble").<br>
<br>
In this output the results (A's) are not different for
double and adouble,<br>
but it will differ if a or b is used in calculation.<br>
<br>
"make_pair(-A,-A)" at line 32 of the source may be
important, because replacing it to<br>
e.g. "make_pair(A,-A)" or "make_pair(-A,A)" changes output.<br>
<br>
About valgrind, on Fedora on virtual machine (as I couldn't
make valgrind work in Mac and Debian), with<br>
$ valgrind -v ./a.out<br>
outputted this: <a moz-do-not-send="true"
href="http://pastebin.ca/2430874">http://pastebin.ca/2430874</a><br>
<br>
I got the same result in previous two environments and on
Fedora above.<br>
<br>
Thank you,<br>
Tomita<br>
<br>
On 2013/08/12, at 0:12, Norman Goldstein <<a
moz-do-not-send="true" href="mailto:normvcr@telus.net">normvcr@telus.net</a>>
wrote:<br>
<br>
<blockquote type="cite">Perhaps running a memory checker,
such as valgrind on linux, would be insightful?<br>
<br>
<br>
On 08/11/2013 12:55 AM, Nozomu Tomita wrote:<br>
<blockquote type="cite">Dear all,<br>
<br>
I'm writing 3-dimensional geometrical calculation, such
as how long a line penetrates a box,<br>
with templated class.<br>
<br>
The problem is that my templated function returns
different results for double and adouble,<br>
and "const adouble" quantities seem to change in the
middle of calculation.<br>
<br>
I'm sorry for the mess of source code, but I couldn't
pick out the exact place that harms...<br>
<br>
My code <a moz-do-not-send="true"
href="http://pastebin.ca/2430586">http://pastebin.ca/2430586</a>
is meant to do an identical calculation for both double
and adouble,<br>
checking whether a line that is parallel to z-axis and
on (1/2, 1/2, 0), penetrates<br>
a square (0,0,0)-(1,0,0)-(1,1,0)-(0,1,0).<br>
<br>
That returns correctly true for double, but false for
adouble.<br>
Compiling this with -DDEBUG produces this output: <a
moz-do-not-send="true"
href="http://pastebin.ca/2430588">http://pastebin.ca/2430588</a><br>
<br>
Line 55 - 67 of this output correspond to line 173 - 216
of source with template argument Real==adouble.<br>
The Odd thing is that although X and u (and its members)
are declared as const,<br>
they change during calculation, from line 57 (u ==
vector3(0(a), 0(a), 1(a)))<br>
and line 59 (u == vector3(0(a), 0(a), 0(a))).<br>
<br>
<br>
I tested this result for ADOL-C 2.4.1 in two
environments:<br>
* Debian 6.0.1,<br>
with g++ (Debian 4.4.5-8) 4.4.5<br>
* MacOS X 10.8.4,<br>
with g++ i686-apple-darwin11-llvm-g++-4.2 (GCC) 4.2.1
(Based on Apple Inc. build 5658) (LLVM build 2336.11.00)<br>
<br>
<br>
Thank you!<br>
<br>
Tomita<br>
_______________________________________________<br>
ADOL-C mailing list<br>
<a moz-do-not-send="true"
href="mailto:ADOL-C@list.coin-or.org">ADOL-C@list.coin-or.org</a><br>
<a class="moz-txt-link-freetext" href="http://list.coin-or.org/mailman/listinfo/adol-c">http://list.coin-or.org/mailman/listinfo/adol-c</a><br>
<br>
</blockquote>
<br>
_______________________________________________<br>
ADOL-C mailing list<br>
<a moz-do-not-send="true"
href="mailto:ADOL-C@list.coin-or.org">ADOL-C@list.coin-or.org</a><br>
<a class="moz-txt-link-freetext" href="http://list.coin-or.org/mailman/listinfo/adol-c">http://list.coin-or.org/mailman/listinfo/adol-c</a><br>
</blockquote>
<br>
_______________________________________________<br>
ADOL-C mailing list<br>
<a moz-do-not-send="true"
href="mailto:ADOL-C@list.coin-or.org">ADOL-C@list.coin-or.org</a><br>
<a class="moz-txt-link-freetext" href="http://list.coin-or.org/mailman/listinfo/adol-c">http://list.coin-or.org/mailman/listinfo/adol-c</a><br>
<br>
</blockquote>
<br>
<br>
_______________________________________________<br>
ADOL-C mailing list<br>
<a moz-do-not-send="true"
href="mailto:ADOL-C@list.coin-or.org">ADOL-C@list.coin-or.org</a><br>
<a class="moz-txt-link-freetext" href="http://list.coin-or.org/mailman/listinfo/adol-c">http://list.coin-or.org/mailman/listinfo/adol-c</a></blockquote>
</div>
<br>
<br>
<fieldset class="mimeAttachmentHeader"></fieldset>
<br>
<pre wrap="">_______________________________________________
ADOL-C mailing list
<a class="moz-txt-link-abbreviated" href="mailto:ADOL-C@list.coin-or.org">ADOL-C@list.coin-or.org</a>
<a class="moz-txt-link-freetext" href="http://list.coin-or.org/mailman/listinfo/adol-c">http://list.coin-or.org/mailman/listinfo/adol-c</a></pre>
</blockquote>
<br>
</body>
</html>