------- Additional Comments From pluto at pld-linux dot org 2005-02-24 23:44 ------- (In reply to comment #6) > I have no idea what is going on here but I will note that "-O3 -fno-tree-dominator-opts" works. > "-O3 -fno-ivopts" does not work > "-O3 -fno-strict-aliasing" does not work. I've looked into final tree-dump and found something interesting. In the source we can find a [2] strcpy(startbuf, ...) which can change the state of startbuf between [1] and [3]. if (usestart) { [1] if (*startbuf == '\0' && zp->z_format != NULL && strchr(zp->z_format, '%') == NULL && strchr(zp->z_format, '/') == NULL) [2] (void) strcpy(startbuf, zp->z_format); eat(zp->z_filename, zp->z_linenum); [3] if (*startbuf == '\0') error(_("can't determine time zone abbreviation to use just after until time")); else addtt(starttime, addtype(startoff, startbuf, startoff != zp->z_gmtoff, startttisstd, startttisgmt)); } Diff shows that the optimizer assumed D.10077=startbuf[0] incorrectly as const because <L219> can change state of startbuf. --- 03-zic.i.t70.final_cleanup-no-tree-dominator-opts 2005-02-25 00:26:09.340849848 +0100 +++ 03-zic.i.t70.final_cleanup 2005-02-25 00:26:03.792693296 +0100 @@ -2,48 +2,44 @@ if (usestart != 0) goto <L213>; else goto <L237>; <L213>:; - if (startbuf[0] == 0) goto <L214>; else goto <L220>; + D.10077 = startbuf[0]; + if (D.10077 == 0) goto <L214>; else goto <L220>; <L214>:; - if (*((const char * *) ivtmp.1013 + 128B) != 0B) goto <L215>; else goto <L220>; + D.10028 = *(D.16876 + 128B); + if (D.10028 != 0B) goto <L215>; else goto <L220>; <L215>:; - __s = *((const char * *) ivtmp.1013 + 128B); - __asm__ __volatile__("1:\n\tmovb\t(%0),%%al\n\tcmpb\t%%ah, %%al\n\tje\t2f\n\tleal\t1(%0),%0\n\ttestb\t%%al,%%al\n\tjne\t1b\n\txorl\t%0, %0\n2:":"=r" __res, "=&a" __d0:"0" __s, "1" 9472, "m" *(struct + __s.107 = (struct { char __x[268435455]; - } *) __s:"cc"); + } *) D.10028; + __asm__ __volatile__("1:\n\tmovb\t(%0),%%al\n\tcmpb\t%%ah, %%al\n\tje\t2f\n\tleal\t1(%0),%0\n\ttestb\t%%al,%%al\n\tjne\t1b\n\txorl\t%0, %0\n2:":"=r" __res, "=&a" __d0:"0" D.10028, "1" 9472, "m" *__s.107:"cc"); if (__res == 0B) goto <L217>; else goto <L220>; <L217>:; - __s = *((const char * *) ivtmp.1013 + 128B); - __asm__ __volatile__("1:\n\tmovb\t(%0),%%al\n\tcmpb\t%%ah, %%al\n\tje\t2f\n\tleal\t1(%0),%0\n\ttestb\t%%al,%%al\n\tjne\t1b\n\txorl\t%0, %0\n2:":"=r" __res, "=&a" __d0:"0" __s, "1" 12032, "m" *(struct - { - char __x[268435455]; - } *) __s:"cc"); + __asm__ __volatile__("1:\n\tmovb\t(%0),%%al\n\tcmpb\t%%ah, %%al\n\tje\t2f\n\tleal\t1(%0),%0\n\ttestb\t%%al,%%al\n\tjne\t1b\n\txorl\t%0, %0\n2:":"=r" __res, "=&a" __d0:"0" D.10028, "1" 12032, "m" *__s.107:"cc"); if (__res == 0B) goto <L219>; else goto <L220>; <L219>:; - __src = *((const char * *) ivtmp.1013 + 128B); __dest.50 = (struct { char __x[268435455]; } *) &startbuf; - __asm__ __volatile__("1:\n\tmovb\t(%0),%b2\n\tleal\t1(%0),%0\n\tmovb\t%b2, (%1)\n\tleal\t1(%1),%1\n\ttestb\t%b2,%b2\n\tjne\t1b":"=&r" __src.1132, "=&r" __tmp, "=&q" __dummy, "=m" *__dest.50:"0" __src, "1" &startbuf, "m" *(struct + __asm__ __volatile__("1:\n\tmovb\t(%0),%b2\n\tleal\t1(%0),%0\n\tmovb\t%b2, (%1)\n\tleal\t1(%1),%1\n\ttestb\t%b2,%b2\n\tjne\t1b":"=&r" __src, "=&r" __tmp, "=&q" __dummy, "=m" *__dest.50:"0" D.10028, "1" &startbuf, "m" *(struct { char __x[268435455]; - } *) __src:"cc"); + } *) D.10028:"cc"); <L220>:; - num = *((int *) ivtmp.1013 + 112B); - name = *((const char * *) ivtmp.1013 + 108B); - filename = name; + num = *D.16875; + filename = *D.16877; linenum = num; rfilename = 0B; rlinenum = -1; - if (startbuf[0] == 0) goto <L225>; else goto <L226>; + if (D.10077 == 0) goto <L225>; else goto <L226>; <L225>:; D.10084 = __dcgettext (&_libc_intl_domainname, &"can\'t determine time zone abbreviation to use just after until time"[0], 5); error (D.10084); - goto <bb 173> (<L237>); + goto <bb 155> (<L237>);
-- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=20188