<br><br><div class="gmail_quote">On Wed, Apr 6, 2011 at 1:41 AM, Duncan Sands <span dir="ltr"><<a href="mailto:baldrick@free.fr">baldrick@free.fr</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">

Hi Arushi,<div class="im"><br>
<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
When it asks for the castOpcode, it assumes both types are unsigned(indicated by<br>
the false arguments).<br>
<br>
Is it correct to assume this?<br>
</blockquote>
<br></div>
yes, because the behaviour of the original code was undefined.<br>
<br>
Ciao, Duncan.<br>
<br>
PS: This is the sort of thing that happens when a function is declared with a<br>
prototype such as<br>
  void *Cyclotomic(void *, long, int)<br>
but the function actually has a different prototype, for example<br>
  void *Cyclotomic(void *, long, long)<br>
and the function is called from a place that has only seen the wrong prototype.<br>
In short, this is usually a bug in the original code.  Confusion between int and<br>
long is common, since on 32 bit platforms they are the same but differ on 64 bit<br>
platforms.  Of course it could also be a compiler bug.  You got this from<br>
compiling Fortran with dragonegg, right?  What was the original code?<br>
</blockquote></div><br><div>I got this from C code compiled by llvm-gcc. </div><div><br></div><div>There is a consistent prototype for the function</div><div><br></div><div><div>TypHandle       Cyclotomic ( hdRes, n, m )</div>

<div>    TypHandle           hdRes;</div><div>    long                n,  m;</div></div><div><br></div><div>the call looks as follows,</div><div> hdI = ProdCyc( hdI, Cyclotomic( HdResult, n, 1 ) );</div><div><br></div><div>

which is basically </div><div><br></div><div>Cyclotomic( HdResult, n, 1 );</div><div><br></div><div>The problem is the fact that it interprets 1 as an int32 instead of an int64. And later converts it by assuming an unsigned to unsigned cast.</div>

<div><br></div><div>Arushi</div>