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



Jakub Jelinek <jakub at gcc dot gnu.org> changed:



           What    |Removed                     |Added

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

                 CC|                            |jakub at gcc dot gnu.org

   Target Milestone|---                         |4.7.3

            Summary|Wrong constant folding      |[4.6/4.7/4.8/4.9

                   |                            |Regression] Wrong constant

                   |                            |folding



--- Comment #7 from Jakub Jelinek <jakub at gcc dot gnu.org> 2013-04-10 
08:23:00 UTC ---

I guess http://gcc.gnu.org/r152217 .  Anyway, shouldn't be hard to reproduce

even with plus (say if v is negative).



I've tried

__attribute__((noinline, noclone)) void

foo (int v)

{

  int x = 214748365 * (v + 1);

  if (x != -1932735285)

    __builtin_abort ();

}



int

main ()

{

  foo (-10);

  return 0;

}

but we don't miscompile it, because while we perform the distributive law in

that case too (also wrongly), it is folded back to the (v + 1) * 214748365

form (after recursing several times between the two forms).

Reply via email to