[Expat-bugs] [ expat-Bugs-808331 ] Faulty code generation in function "lookup"

SourceForge.net noreply at sourceforge.net
Thu Sep 18 01:35:28 EDT 2003


Bugs item #808331, was opened at 2003-09-17 22:35
Message generated for change (Tracker Item Submitted) made by Item Submitter
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=110127&aid=808331&group_id=10127

Category: None
Group: Platform Specific
Status: Open
Resolution: None
Priority: 5
Submitted By: Nobody/Anonymous (nobody)
Assigned to: Nobody/Anonymous (nobody)
Summary: Faulty code generation in function "lookup"

Initial Comment:
The function "lookup" in source "xmlparse.c" generates 

faulty code when built for a PocketPC2002 device in 

eMbedded Visual C++ v3.0.  Note that this only occurs 

for a release build, and not for a debug build.



Specifically this block of code at line 5306:



for (i = h & (table->size - 1);

   table->v[i];

   i == 0 ? i = table->size - 1 : --i) {

   if (keyeq(name, table->v[i]->name))

      return table->v[i];

    }



The return statement is generated as a branch to the 

return statement at the end of the function.  The code 

generation fault is in the failure to shift the index i to 

account for the size of the elements of v. 



The alternative is to declare a local variable of type 

NAMED ** to be assigned in the condition clause of the 

for loop and return that instead.



NAMED **n;

for (i = h & (table->size - 1);

   (n = table->v[i]) != NULL;

    i == 0 ? i = table->size - 1 : --i) {

      if (keyeq(name, table->v[i]->name))

        return n;

    }



email address: adam at xtreamlok.com

----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=110127&aid=808331&group_id=10127



More information about the Expat-bugs mailing list