[Bug target/55940] [4.7/4.8 Regression] Incorrect code for accessing parameters with 32-bit Intel hosts

2013-01-15 Thread jakub at gcc dot gnu.org


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



--- Comment #13 from Jakub Jelinek  2013-01-15 
22:58:28 UTC ---

Author: jakub

Date: Tue Jan 15 22:58:21 2013

New Revision: 195220



URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=195220

Log:

PR target/55940

* function.c (thread_prologue_and_epilogue_insns): Always

add crtl->drap_reg to set_up_by_prologue.set, even if

stack_realign_drap is false.



* gcc.dg/pr55940.c: New test.



Added:

trunk/gcc/testsuite/gcc.dg/pr55940.c

Modified:

trunk/gcc/ChangeLog

trunk/gcc/function.c

trunk/gcc/testsuite/ChangeLog


[Bug target/55940] [4.7/4.8 Regression] Incorrect code for accessing parameters with 32-bit Intel hosts

2013-01-15 Thread jakub at gcc dot gnu.org


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



--- Comment #12 from Jakub Jelinek  2013-01-15 
18:28:31 UTC ---

I think:



--- gcc/function.c.jj2013-01-11 09:02:55.0 +0100

+++ gcc/function.c2013-01-15 19:23:20.648826011 +0100

@@ -6029,7 +6029,7 @@ thread_prologue_and_epilogue_insns (void

   if (pic_offset_table_rtx)

 add_to_hard_reg_set (&set_up_by_prologue.set, Pmode,

  PIC_OFFSET_TABLE_REGNUM);

-  if (stack_realign_drap && crtl->drap_reg)

+  if (crtl->drap_reg)

 add_to_hard_reg_set (&set_up_by_prologue.set,

  GET_MODE (crtl->drap_reg),

  REGNO (crtl->drap_reg));



should fix it, in this case we pessimistically assume we might need to realign

the stack and because of -Os we create vDRAP, but then find out we don't

actually need to realign anything.


[Bug target/55940] [4.7/4.8 Regression] Incorrect code for accessing parameters with 32-bit Intel hosts

2013-01-15 Thread jakub at gcc dot gnu.org


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



Jakub Jelinek  changed:



   What|Removed |Added



 Status|WAITING |NEW

   Target Milestone|--- |4.7.3

Summary|Incorrect code for  |[4.7/4.8 Regression]

   |accessing parameters with   |Incorrect code for

   |32-bit Intel hosts  |accessing parameters with

   ||32-bit Intel hosts



--- Comment #11 from Jakub Jelinek  2013-01-15 
17:45:48 UTC ---

Sounds like shrink-wrapping bug to me:



/* { dg-options "-Os" } */

/* { dg-additional-options "-mpreferred-stack-boundary=2" { target { { i?86-*-*

x86_64-*-* } && ia32 } } } */



struct S { int s; unsigned long t; };



__attribute__ ((visibility ("hidden"))) unsigned long long bar (struct S *x,

unsigned long y);



unsigned long long

foo (struct S *x, unsigned long y)

{

  unsigned long a;

  if (__builtin_expect (((unsigned long) (x) + 0x1000U < 0x2000U), 0))

return ~0ULL;

  if (__builtin_expect (x->s <= 0 || x->s > 9, 0))

return ~0ULL;

  a = x->t >> 12;

  if (y >= a && y == a)

return ~0ULL;

  if (x->s == 3)

return x->t + y * 4096;

  return bar (x, y);

}



The pre-prologue code can't use registers initialized in the prologue.