This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: EGCS Optimization bug on HPUX
- To: egcs-bugs at egcs dot cygnus dot com, egcs at egcs dot cygnus dot com
- Subject: Re: EGCS Optimization bug on HPUX
- From: korbb at egcs dot cygnus dot com
- Date: 28 Apr 1999 18:21:14 -0000
- Cc: ddsinc09 at ix dot netcom dot com
Reply-To: ddsinc09@ix.netcom.com
Has this issue ever been addressed or looked at?
I haven't seen followup since
John David Anglin <dave@hiauly1.hia.nrc.ca>
a week ago. Thanks.
> The following code fragment appears in AutoGen's evalExpr_SHSTR
> routine in src/agExpr.c:
>
> *(pz++) = '"';
> for (;;) {
> switch (*(pz++) = *(pzDta++)) {
> case NUL:
> goto loopDone2;
>
> case '"':
> case '\\':
> pz[-1] = '\\';
> *(pz++) = pzDta[-1];
> }
> } loopDone2:;
> pz[-1] = '"';
> *pz = NUL;
>
> AutoGen is available from:
>
> ftp://sourceware.cygnus.com/pub/egcs/infrastructure/autogen.tar.gz
>
> Under optimization levels 2 and above, the value for "pzDta" is
> apparently stored in both a register and in memory _AND_ they are
> not kept in sync. Here is an example from autogen/tests/evalstr.test:
I believe the above observation is essentially correct. However, it
is the synchronization between two registers rather than register and
memory. At -O2 and above, additional registers are used to hold pz-1
and pzDta-1. These registers are not properly kept in sync with the
registers used for pz and pzDta.
I created this test program:
#define NUL 0
void loop (char * pz, char * pzDta)
{
for (;;) {
switch (*(pz++) = *(pzDta++)) {
case NUL:
goto loopDone2;
case '"':
case '\\':
pz[-1] = '\\';
*(pz++) = pzDta[-1];
}
} loopDone2:;
}
Here is the assembler code at -O1:
[[omitted]]