[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

[Bug tree-optimization/35585] [4.2 Regression] Miscompiled inline assembly




------- Comment #5 from rguenth at gcc dot gnu dot org  2008-03-15 11:28 -------
Sorry.  The tree optimizers produce

<L62>:;
  __asm__ __volatile__("fistl %0":"=m" r:"t" txcum * 2.0e+0 - 5.0e-1);
  D.16879 = r >> 1;
  if (D.16879 < sp->bbox[0]) goto <L105>; else goto <L17>;

<L105>:;
  __b = &D.12083;
  goto <bb 20> (<L18>);

<L17>:;
  __b = &sp->bbox[0];

<L18>:;
  sp->bbox[0] = *__b;

which looks suspicious as well, as D.12083 is not the correct result here
(but in fact is uninitialized).  And this is store-sinking which makes
a mess of it:

Sinking #   D.12083_947 = V_MUST_DEF <D.12083_380>;
D.12083 = D.16879_333 from bb 21 to bb 52

because of wrong alias information computed right before this pass:

<L62>:;
  D.16874_329 = txcum_285 * 2.0e+0;
  x_330 = D.16874_329 - 5.0e-1;
  #   r_946 = V_MAY_DEF <r_288>;
  __asm__ __volatile__("fistl %0":"=m" r:"t" x_330);
  #   VUSE <r_946>;
  r.41_332 = r;
  D.16879_333 = r.41_332 >> 1;
  #   D.12083_947 = V_MUST_DEF <D.12083_380>;
  D.12083 = D.16879_333;
  #   VUSE <SFT.738_136>;
  #   VUSE <SFT.739_451>;
  #   VUSE <SFT.740_367>;
  D.16880_340 = sp_119->bbox[0];
  if (D.16879_333 < D.16880_340) goto <L91>; else goto <L17>;

<L91>:;
  goto <bb 23> (<L18>);

<L17>:;
  __b_342 = &sp_119->bbox[0];

  # __b_5 = PHI <&D.12083(48), __b_342(22)>;
<L18>:;
  #   VUSE <r_946>;
  #   VUSE <r_284>;
  #   VUSE <r_6>;
  #   VUSE <r_43>;
  D.12120_344 = *__b_5;


Oh well, it's not that 4.2 does not have known aliasing related problems.


-- 

rguenth at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|RESOLVED                    |UNCONFIRMED
          Component|c++                         |tree-optimization
           Keywords|                            |alias, wrong-code
           Priority|P3                          |P2
         Resolution|DUPLICATE                   |
            Summary|Miscompiled inline assembly |[4.2 Regression] Miscompiled
                   |                            |inline assembly
   Target Milestone|---                         |4.2.4


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

------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.


Reply to: