[Prev][Next][Index]
Problems with SgType::equivalentToType()
- Subject: Problems with SgType::equivalentToType()
- From: Diego Novillo <diego@cs.ualberta.ca>
- To: sage-bugs@cica.indiana.edu ( Sage bug reports)
- Date: Tue, 4 Oct 1994 11:45:32 -0600 (MDT)
Hi,
I'm having some problems with SgType::equivalentToType(). My
program needs to do some type checking on the arguments to a function
call. The code is something like this:
for (int i = 0; i < fn->numberOfArgs(); i++) {
SgExpression *arg = fn->arg(i);
if (isSgPointerType(arg->type())) {
//
// Next argument must be an integer specifying
// how much data to send.
//
SgType integer(T_INT);
arg = fn->arg(i + 1);
if (!arg || !arg->type()->equivalentToType(integer))
error(...)
else
ok(...)
}
}
The code that I'm checking is:
function(ptr, strlen(ptr));
The function strlen() returns a value of type 'size_t' which is
defined as 'typedef int size_t'. Therefore, this code should be
checked ok, but the call to SgType::equivalentToType() is returning 0
instead of 1.
Am I doing something wrong here? Is there another way to check type
equivalence?
Thanks. Diego.
--
Diego A. Novillo | "We each pay a fabulous price for our
diego@cs.ualberta.ca | visions of paradise. But a spirit with
Computing Science - U of Alberta | a vision is a dream with a mission"
Edmonton, Alberta - Canada | Rush - Mission
Follow-Up(s):