Problems with SgStatement::copy()


	I am having problems with SgStatement::copy() and I don't know 
whether it's me or is it a bug in the library. I have a function that 
needs to do allocate memory for a new statement and deep copy an existing 
statement to the new memory location. My code looks something like this,

EntAssetCall::EntAssetCall(SgStatement *r_st)
        if (r_st) {
                st = new SgStatement(r_st->variant());
		if (st)
			*st = r_st->copy();
        } else
                st = 0;

So, this constructor wants to make a deep copy of the original
statement by calling copy(). However, I am losing line number
information in the process. Here's a gdb session so you can see what's
going on.

25                      st = new SgStatement(r_st->variant());
(gdb) n
27                      if (st)
(gdb) s
32                      *st = r_st->copy();
(gdb) n
35      }
(gdb) print st->lineNumber()
$11 = 0
(gdb) print r_st->lineNumber()
$12 = 38
(gdb) print st
$13 = (SgStatement *) 0x24f820
(gdb) print r_st
$14 = (SgStatement *) 0x24f610
(gdb) print *st
$15 = {thebif = 0x24f9b0}
(gdb) print *r_st
$16 = {thebif = 0x252110}

As you can see, after the copy is made, the new statement doesn't have
line number information (however, the file name and the statement
itself are being copied).



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