[Bug tree-optimization/38051] [4.4 Regression] Miscompilation of glibc's memcmp

jakub at gcc dot gnu dot org gcc-bugzilla@gcc.gnu.org
Fri Nov 7 16:33:00 GMT 2008



------- Comment #4 from jakub at gcc dot gnu dot org  2008-11-07 16:32 -------
*.copyprop4 still contains the needed stores:
  [gg5.c : 151] D.2147_293 = a3D.2068_292 >> shlD.2074_195;
  [gg5.c : 151] D.2148_295 = a0D.2065_294 << shrD.2075_198;
  [gg5.c : 151] xD.2073_296 = D.2148_295 | D.2147_293;
  [gg5.c : 152] if (xD.2073_296 != b0D.2069_297)
    goto <bb 51>;
  else
    goto <bb 55> (do2);
  # SUCC: 51 [72.0%]  (true,exec) 55 [28.0%]  (irreducible,false,exec)

  # BLOCK 51 freq:370, starting at line 0
  # PRED: 50 [72.0%]  (true,exec)
  # aD.2099_621 = VDEF <aD.2099_620(D)> { aD.2099 }
  aD.2099 = xD.2073_296;
  # bD.2098_623 = VDEF <bD.2098_622(D)> { bD.2098 }
  bD.2098 = b0D.2069_297;
  [gg5.c : 8] srcp1D.2100_298 = (long intD.2) [gg5.c : 8] &aD.2099;
  [gg5.c : 9] srcp2D.2101_299 = (long intD.2) [gg5.c : 9] &bD.2098;

  # BLOCK 52 freq:2640
  # PRED: 51 [100.0%]  (fallthru,exec) 53 [100.0%]  (fallthru,exec)
  # srcp1D.2100_300 = PHI <srcp1D.2100_298(51), srcp1D.2100_308(53)>
  # srcp2D.2101_304 = PHI <srcp2D.2101_299(51), srcp2D.2101_309(53)>
  [gg5.c : 13] srcp1.0D.2149_301 = (unsigned charD.10 *) srcp1D.2100_300;
  [gg5.c : 13] # VUSE <aD.1965_413(D), bD.1970_414(D), aD.1971_415(D),
bD.1976_416(D), aD.1977_417(D), bD.1982_418(D), aD.1983_41
9(D), SMT.25D.2200_420(D)> { aD.1965 bD.1970 aD.1971 bD.1976 aD.1977 bD.1982
aD.1983 SMT.25D.2200 }
  D.2150_302 = *srcp1.0D.2149_301;
  [gg5.c : 13] a0D.2102_303 = (long unsigned intD.4) D.2150_302;
  [gg5.c : 14] srcp2.1D.2151_305 = (unsigned charD.10 *) srcp2D.2101_304;
  [gg5.c : 14] # VUSE <aD.1965_413(D), bD.1970_414(D), aD.1971_415(D),
bD.1976_416(D), aD.1977_417(D), bD.1982_418(D), aD.1983_41
9(D), SMT.25D.2200_420(D)> { aD.1965 bD.1970 aD.1971 bD.1976 aD.1977 bD.1982
aD.1983 SMT.25D.2200 }
  D.2152_306 = *srcp2.1D.2151_305;

(a = x and b = b0) before taking their addresses, but *.dceloop1 nukes them,
supposedly because VUSE on the *srcp1 and *srcp2 reads is wrong.  This is with
-O2 -fno-strict-aliasing, but even with strict aliasing taking an address of an
unsigned long variable, casting it to unsigned char * and reading it a single
byte at a time through unsigned char * pointer is valid.


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=38051



More information about the Gcc-bugs mailing list