[Prev][Next][Index]

Bad Typing of &(y[2]).




[This would be a serious problem if it occurred more often in my code.]

** pC++2dep gets the wrong type for &(y[2]).
The test problem is a little long b/c I use it for an AD test as well.
You need only examine the last assignment with dumpdep. 49-E is the
right hand side, with type 26-T == T_PTR(-1)->T_PTR(1)->T_ARRAY.

------------------------------------------------------------------------
/*
   Test wierd pulling of wrong type from a function call. 

   The bug was that the &y[2] was pulled. It's confusing because
   the &x was not. Worse, it is pulled to a temporary of type double!

   This is an UGLY Sage bug... gets the wrong type of &(y[3]), 
   consistently and under many circumstances.
*/

extern int sscanf(...);

int main (void)
{
     double x;
     double y[10];
     double *z;
     sscanf("%ld",&x);
     sscanf("%ld",&y[2]);
     sscanf("%ld",&(y[2]));

     z = &(y[3]);
     return 0;
}
------------------------------------------------------------------------



Follow-Up(s):