public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/45234]  New: ICE in expand_call, at calls.c:2845 when passing aligned function argument from unaligned stack after alloca
@ 2010-08-08 21:04 truedfx at gentoo dot org
  2010-08-08 22:01 ` [Bug target/45234] " rguenth at gcc dot gnu dot org
                   ` (25 more replies)
  0 siblings, 26 replies; 27+ messages in thread
From: truedfx at gentoo dot org @ 2010-08-08 21:04 UTC (permalink / raw)
  To: gcc-bugs

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain, Size: 1187 bytes --]

$ cat bug.c
extern void f (__float128);
void g(void)
{
  __builtin_alloca (2);
  f (0);
}
$ gcc -m32 -mpreferred-stack-boundary=2 -c bug.c
bug.c: In function ‘g’:
bug.c:5:5: internal compiler error: in expand_call, at calls.c:2840
Please submit a full bug report,
with preprocessed source if appropriate.
See <http://bugs.gentoo.org/> for instructions.

First seen in modified GCC, but with some modifications to the code the ICE
also triggers on unpatched GCC on x86 with the above code. Tested with GCC
4.4.4 from Fedora and GCC 4.5.0 from Gentoo.

With -mno-accumulate-outgoing-args, GCC accepts the code.


-- 
           Summary: ICE in expand_call, at calls.c:2845 when passing aligned
                    function argument from unaligned stack after alloca
           Product: gcc
           Version: 4.5.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: truedfx at gentoo dot org
 GCC build triplet: i686-pc-linux-gnu
  GCC host triplet: i686-pc-linux-gnu
GCC target triplet: i686-pc-linux-gnu


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


^ permalink raw reply	[flat|nested] 27+ messages in thread

* [Bug target/45234] ICE in expand_call, at calls.c:2845 when passing aligned function argument from unaligned stack after alloca
  2010-08-08 21:04 [Bug c/45234] New: ICE in expand_call, at calls.c:2845 when passing aligned function argument from unaligned stack after alloca truedfx at gentoo dot org
@ 2010-08-08 22:01 ` rguenth at gcc dot gnu dot org
  2010-08-08 22:45 ` truedfx at gentoo dot org
                   ` (24 subsequent siblings)
  25 siblings, 0 replies; 27+ messages in thread
From: rguenth at gcc dot gnu dot org @ 2010-08-08 22:01 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #1 from rguenth at gcc dot gnu dot org  2010-08-08 22:01 -------
Confirmed.  GCC 4.3 rejects the code (no __float128), so not a regression.


-- 

rguenth at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
          Component|c                           |target
     Ever Confirmed|0                           |1
 GCC target triplet|i686-pc-linux-gnu           |i?86-pc-linux-gnu
           Keywords|                            |ice-on-valid-code
      Known to fail|                            |4.4.4 4.5.1 4.6.0
   Last reconfirmed|0000-00-00 00:00:00         |2010-08-08 22:01:25
               date|                            |


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


^ permalink raw reply	[flat|nested] 27+ messages in thread

* [Bug target/45234] ICE in expand_call, at calls.c:2845 when passing aligned function argument from unaligned stack after alloca
  2010-08-08 21:04 [Bug c/45234] New: ICE in expand_call, at calls.c:2845 when passing aligned function argument from unaligned stack after alloca truedfx at gentoo dot org
  2010-08-08 22:01 ` [Bug target/45234] " rguenth at gcc dot gnu dot org
@ 2010-08-08 22:45 ` truedfx at gentoo dot org
  2010-08-08 23:10 ` truedfx at gentoo dot org
                   ` (23 subsequent siblings)
  25 siblings, 0 replies; 27+ messages in thread
From: truedfx at gentoo dot org @ 2010-08-08 22:45 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #2 from truedfx at gentoo dot org  2010-08-08 22:44 -------
_Decimal128 has the same problem, and is supported by gcc 4.3, so this may
trigger there too (but I don't have 4.3 installed to check right now)


-- 


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


^ permalink raw reply	[flat|nested] 27+ messages in thread

* [Bug target/45234] ICE in expand_call, at calls.c:2845 when passing aligned function argument from unaligned stack after alloca
  2010-08-08 21:04 [Bug c/45234] New: ICE in expand_call, at calls.c:2845 when passing aligned function argument from unaligned stack after alloca truedfx at gentoo dot org
  2010-08-08 22:01 ` [Bug target/45234] " rguenth at gcc dot gnu dot org
  2010-08-08 22:45 ` truedfx at gentoo dot org
@ 2010-08-08 23:10 ` truedfx at gentoo dot org
  2010-08-09 15:24 ` ubizjak at gmail dot com
                   ` (22 subsequent siblings)
  25 siblings, 0 replies; 27+ messages in thread
From: truedfx at gentoo dot org @ 2010-08-08 23:10 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #3 from truedfx at gentoo dot org  2010-08-08 23:09 -------
I've configured a minimal 4.3.5 compiler, and testing shows that

extern void f (_Decimal128);
void g(void)
{
  __builtin_alloca (2);
  f (0);
}

which also fails with the same ICE with 4.5.0 and 4.4.4, actually works with
4.3.5.


-- 


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


^ permalink raw reply	[flat|nested] 27+ messages in thread

* [Bug target/45234] ICE in expand_call, at calls.c:2845 when passing aligned function argument from unaligned stack after alloca
  2010-08-08 21:04 [Bug c/45234] New: ICE in expand_call, at calls.c:2845 when passing aligned function argument from unaligned stack after alloca truedfx at gentoo dot org
                   ` (2 preceding siblings ...)
  2010-08-08 23:10 ` truedfx at gentoo dot org
@ 2010-08-09 15:24 ` ubizjak at gmail dot com
  2010-08-09 15:51 ` hjl dot tools at gmail dot com
                   ` (21 subsequent siblings)
  25 siblings, 0 replies; 27+ messages in thread
From: ubizjak at gmail dot com @ 2010-08-09 15:24 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #4 from ubizjak at gmail dot com  2010-08-09 15:24 -------
H.J, this was introduced by your commit:

138808        hjl   /* Ensure current function's preferred stack boundary is at
least
138808        hjl      what we need.  Stack alignment may also increase
preferred stack
138808        hjl      boundary.  */
137045       uros   if (crtl->preferred_stack_boundary <
preferred_stack_boundary)
134425    hubicka     crtl->preferred_stack_boundary =
preferred_stack_boundary;
138808  ***   hjl   else
138808  ***   hjl     preferred_stack_boundary =
crtl->preferred_stack_boundary;
 31831    hubicka 
 33913    hubicka   preferred_unit_stack_boundary = preferred_stack_boundary /
BITS_PER_UNIT;
   201        rms 

By backing out lines marked as ***, compilation succeeds.


-- 


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


^ permalink raw reply	[flat|nested] 27+ messages in thread

* [Bug target/45234] ICE in expand_call, at calls.c:2845 when passing aligned function argument from unaligned stack after alloca
  2010-08-08 21:04 [Bug c/45234] New: ICE in expand_call, at calls.c:2845 when passing aligned function argument from unaligned stack after alloca truedfx at gentoo dot org
                   ` (3 preceding siblings ...)
  2010-08-09 15:24 ` ubizjak at gmail dot com
@ 2010-08-09 15:51 ` hjl dot tools at gmail dot com
  2010-08-09 16:04 ` [Bug target/45234] [4.4 Regression] " rguenth at gcc dot gnu dot org
                   ` (20 subsequent siblings)
  25 siblings, 0 replies; 27+ messages in thread
From: hjl dot tools at gmail dot com @ 2010-08-09 15:51 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #5 from hjl dot tools at gmail dot com  2010-08-09 15:51 -------
(In reply to comment #4)
> H.J, this was introduced by your commit:
> 
...
> 
> By backing out lines marked as ***, compilation succeeds.
> 

Can you take a look at the assembly output to see if
the stack is realigned properly?


-- 


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


^ permalink raw reply	[flat|nested] 27+ messages in thread

* [Bug target/45234] [4.4 Regression] ICE in expand_call, at calls.c:2845 when passing aligned function argument from unaligned stack after alloca
  2010-08-08 21:04 [Bug c/45234] New: ICE in expand_call, at calls.c:2845 when passing aligned function argument from unaligned stack after alloca truedfx at gentoo dot org
                   ` (4 preceding siblings ...)
  2010-08-09 15:51 ` hjl dot tools at gmail dot com
@ 2010-08-09 16:04 ` rguenth at gcc dot gnu dot org
  2010-08-09 16:16 ` truedfx at gentoo dot org
                   ` (19 subsequent siblings)
  25 siblings, 0 replies; 27+ messages in thread
From: rguenth at gcc dot gnu dot org @ 2010-08-09 16:04 UTC (permalink / raw)
  To: gcc-bugs



-- 

rguenth at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
            Summary|ICE in expand_call, at      |[4.4 Regression] ICE in
                   |calls.c:2845 when passing   |expand_call, at calls.c:2845
                   |aligned function argument   |when passing aligned
                   |from unaligned stack after  |function argument from
                   |alloca                      |unaligned stack after alloca
   Target Milestone|---                         |4.4.5


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


^ permalink raw reply	[flat|nested] 27+ messages in thread

* [Bug target/45234] [4.4 Regression] ICE in expand_call, at calls.c:2845 when passing aligned function argument from unaligned stack after alloca
  2010-08-08 21:04 [Bug c/45234] New: ICE in expand_call, at calls.c:2845 when passing aligned function argument from unaligned stack after alloca truedfx at gentoo dot org
                   ` (5 preceding siblings ...)
  2010-08-09 16:04 ` [Bug target/45234] [4.4 Regression] " rguenth at gcc dot gnu dot org
@ 2010-08-09 16:16 ` truedfx at gentoo dot org
  2010-08-09 16:19 ` hjl dot tools at gmail dot com
                   ` (18 subsequent siblings)
  25 siblings, 0 replies; 27+ messages in thread
From: truedfx at gentoo dot org @ 2010-08-09 16:16 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #6 from truedfx at gentoo dot org  2010-08-09 16:15 -------
With those two lines removed from 4.5.0, it looks like the stack will be
aligned properly by accident. When changing __builtin_alloca (2) to
__builtin_alloca (6), the only thing that changes in the generated code is

@@ -10,7 +10,7 @@
        movl    %esp, %ebp
        pushl   %ecx
        subl    $20, %esp
-       subl    $20, %esp
+       subl    $24, %esp
        movdqa  .LC0, %xmm0
        movdqa  %xmm0, (%esp)
        call    f


-- 


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


^ permalink raw reply	[flat|nested] 27+ messages in thread

* [Bug target/45234] [4.4 Regression] ICE in expand_call, at calls.c:2845 when passing aligned function argument from unaligned stack after alloca
  2010-08-08 21:04 [Bug c/45234] New: ICE in expand_call, at calls.c:2845 when passing aligned function argument from unaligned stack after alloca truedfx at gentoo dot org
                   ` (6 preceding siblings ...)
  2010-08-09 16:16 ` truedfx at gentoo dot org
@ 2010-08-09 16:19 ` hjl dot tools at gmail dot com
  2010-08-09 16:29 ` hjl dot tools at gmail dot com
                   ` (17 subsequent siblings)
  25 siblings, 0 replies; 27+ messages in thread
From: hjl dot tools at gmail dot com @ 2010-08-09 16:19 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #7 from hjl dot tools at gmail dot com  2010-08-09 16:19 -------
__builtin_alloca (var) is handled properly. __builtin_alloca (const int)
is a special case. I am looking into it now.


-- 

hjl dot tools at gmail dot com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|4.4.5                       |---


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


^ permalink raw reply	[flat|nested] 27+ messages in thread

* [Bug target/45234] [4.4 Regression] ICE in expand_call, at calls.c:2845 when passing aligned function argument from unaligned stack after alloca
  2010-08-08 21:04 [Bug c/45234] New: ICE in expand_call, at calls.c:2845 when passing aligned function argument from unaligned stack after alloca truedfx at gentoo dot org
                   ` (7 preceding siblings ...)
  2010-08-09 16:19 ` hjl dot tools at gmail dot com
@ 2010-08-09 16:29 ` hjl dot tools at gmail dot com
  2010-08-09 16:39 ` hjl dot tools at gmail dot com
                   ` (16 subsequent siblings)
  25 siblings, 0 replies; 27+ messages in thread
From: hjl dot tools at gmail dot com @ 2010-08-09 16:29 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #8 from hjl dot tools at gmail dot com  2010-08-09 16:28 -------
/* Adjust the stack pointer by minus ADJUST (an rtx for a number of bytes).
   This pushes when ADJUST is positive.  ADJUST need not be constant.  */

void
anti_adjust_stack (rtx adjust)
{
  rtx temp;

  if (adjust == const0_rtx)
    return;

  /* We expect all variable sized adjustments to be multiple of
     PREFERRED_STACK_BOUNDARY.  */
  if (CONST_INT_P (adjust))
    stack_pointer_delta += INTVAL (adjust);

However, PREFERRED_STACK_BOUNDARY isn't fixed at this time.


-- 


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


^ permalink raw reply	[flat|nested] 27+ messages in thread

* [Bug target/45234] [4.4 Regression] ICE in expand_call, at calls.c:2845 when passing aligned function argument from unaligned stack after alloca
  2010-08-08 21:04 [Bug c/45234] New: ICE in expand_call, at calls.c:2845 when passing aligned function argument from unaligned stack after alloca truedfx at gentoo dot org
                   ` (8 preceding siblings ...)
  2010-08-09 16:29 ` hjl dot tools at gmail dot com
@ 2010-08-09 16:39 ` hjl dot tools at gmail dot com
  2010-08-09 16:58 ` truedfx at gentoo dot org
                   ` (15 subsequent siblings)
  25 siblings, 0 replies; 27+ messages in thread
From: hjl dot tools at gmail dot com @ 2010-08-09 16:39 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #9 from hjl dot tools at gmail dot com  2010-08-09 16:38 -------
Does this patch:

--
diff --git a/gcc/calls.c b/gcc/calls.c
index cd0d9c5..cbb0944 100644
--- a/gcc/calls.c
+++ b/gcc/calls.c
@@ -2846,7 +2846,8 @@ expand_call (tree exp, rtx target, int ignore)

       /* Stack must be properly aligned now.  */
       gcc_assert (!pass
-       || !(stack_pointer_delta % preferred_unit_stack_boundary));
+       || !(stack_pointer_delta
+            % (PREFERRED_STACK_BOUNDARY / BITS_PER_UNIT)));

       /* Generate the actual call instruction.  */
       emit_call_1 (funexp, exp, fndecl, funtype, unadjusted_args_size,
--

make any senses?


-- 


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


^ permalink raw reply	[flat|nested] 27+ messages in thread

* [Bug target/45234] [4.4 Regression] ICE in expand_call, at calls.c:2845 when passing aligned function argument from unaligned stack after alloca
  2010-08-08 21:04 [Bug c/45234] New: ICE in expand_call, at calls.c:2845 when passing aligned function argument from unaligned stack after alloca truedfx at gentoo dot org
                   ` (9 preceding siblings ...)
  2010-08-09 16:39 ` hjl dot tools at gmail dot com
@ 2010-08-09 16:58 ` truedfx at gentoo dot org
  2010-08-09 17:01 ` hjl dot tools at gmail dot com
                   ` (14 subsequent siblings)
  25 siblings, 0 replies; 27+ messages in thread
From: truedfx at gentoo dot org @ 2010-08-09 16:58 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #10 from truedfx at gentoo dot org  2010-08-09 16:58 -------
I had already tried simply commenting out the assert, and that caused wrong
code, so changing the assert without anything else won't help :)

FWIW, I now also checked the code difference between alloca(2) and alloca(6)
with 4.3.5, and it looks like that gets it wrong:

@@ -5,7 +5,7 @@
 g:
        pushl   %ebp
        movl    %esp, %ebp
-       subl    $36, %esp
+       subl    $40, %esp
        movdqa  .LC0, %xmm0
        movaps  %xmm0, (%esp)
        call    f

so this isn't really a regression, it just changed from wrong code to an ICE,
which is an improvement IMO.


-- 


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


^ permalink raw reply	[flat|nested] 27+ messages in thread

* [Bug target/45234] [4.4 Regression] ICE in expand_call, at calls.c:2845 when passing aligned function argument from unaligned stack after alloca
  2010-08-08 21:04 [Bug c/45234] New: ICE in expand_call, at calls.c:2845 when passing aligned function argument from unaligned stack after alloca truedfx at gentoo dot org
                   ` (10 preceding siblings ...)
  2010-08-09 16:58 ` truedfx at gentoo dot org
@ 2010-08-09 17:01 ` hjl dot tools at gmail dot com
  2010-08-09 17:24 ` hjl dot tools at gmail dot com
                   ` (13 subsequent siblings)
  25 siblings, 0 replies; 27+ messages in thread
From: hjl dot tools at gmail dot com @ 2010-08-09 17:01 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #11 from hjl dot tools at gmail dot com  2010-08-09 17:01 -------
(In reply to comment #9)
> Does this patch:
> 
> --
> diff --git a/gcc/calls.c b/gcc/calls.c
> index cd0d9c5..cbb0944 100644
> --- a/gcc/calls.c
> +++ b/gcc/calls.c
> @@ -2846,7 +2846,8 @@ expand_call (tree exp, rtx target, int ignore)
> 
>        /* Stack must be properly aligned now.  */
>        gcc_assert (!pass
> -       || !(stack_pointer_delta % preferred_unit_stack_boundary));
> +       || !(stack_pointer_delta
> +            % (PREFERRED_STACK_BOUNDARY / BITS_PER_UNIT)));
> 
>        /* Generate the actual call instruction.  */
>        emit_call_1 (funexp, exp, fndecl, funtype, unadjusted_args_size,
> --
> 
> make any senses?
> 

This is incorrect. If SUPPORTS_STACK_ALIGNMENT is true, expand_call needs
to check stack_pointer_delta and preferred_unit_stack_boundary, and adjust
stack is needed before expanding call if needed.


-- 


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


^ permalink raw reply	[flat|nested] 27+ messages in thread

* [Bug target/45234] [4.4 Regression] ICE in expand_call, at calls.c:2845 when passing aligned function argument from unaligned stack after alloca
  2010-08-08 21:04 [Bug c/45234] New: ICE in expand_call, at calls.c:2845 when passing aligned function argument from unaligned stack after alloca truedfx at gentoo dot org
                   ` (11 preceding siblings ...)
  2010-08-09 17:01 ` hjl dot tools at gmail dot com
@ 2010-08-09 17:24 ` hjl dot tools at gmail dot com
  2010-08-09 17:44 ` truedfx at gentoo dot org
                   ` (12 subsequent siblings)
  25 siblings, 0 replies; 27+ messages in thread
From: hjl dot tools at gmail dot com @ 2010-08-09 17:24 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #12 from hjl dot tools at gmail dot com  2010-08-09 17:24 -------
Created an attachment (id=21442)
 --> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=21442&action=view)
A patch

This patch seems to work for me.


-- 


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


^ permalink raw reply	[flat|nested] 27+ messages in thread

* [Bug target/45234] [4.4 Regression] ICE in expand_call, at calls.c:2845 when passing aligned function argument from unaligned stack after alloca
  2010-08-08 21:04 [Bug c/45234] New: ICE in expand_call, at calls.c:2845 when passing aligned function argument from unaligned stack after alloca truedfx at gentoo dot org
                   ` (12 preceding siblings ...)
  2010-08-09 17:24 ` hjl dot tools at gmail dot com
@ 2010-08-09 17:44 ` truedfx at gentoo dot org
  2010-08-10  5:59 ` truedfx at gentoo dot org
                   ` (11 subsequent siblings)
  25 siblings, 0 replies; 27+ messages in thread
From: truedfx at gentoo dot org @ 2010-08-09 17:44 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #13 from truedfx at gentoo dot org  2010-08-09 17:44 -------
Thanks, that seems to work for me too for the reduced code. I'll test the
original larger code that was failing too, but that'll take a little longer for
me to report back anything.


-- 


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


^ permalink raw reply	[flat|nested] 27+ messages in thread

* [Bug target/45234] [4.4 Regression] ICE in expand_call, at calls.c:2845 when passing aligned function argument from unaligned stack after alloca
  2010-08-08 21:04 [Bug c/45234] New: ICE in expand_call, at calls.c:2845 when passing aligned function argument from unaligned stack after alloca truedfx at gentoo dot org
                   ` (13 preceding siblings ...)
  2010-08-09 17:44 ` truedfx at gentoo dot org
@ 2010-08-10  5:59 ` truedfx at gentoo dot org
  2010-08-10  9:00 ` [Bug target/45234] [4.4/4.5/4.6 " rguenth at gcc dot gnu dot org
                   ` (10 subsequent siblings)
  25 siblings, 0 replies; 27+ messages in thread
From: truedfx at gentoo dot org @ 2010-08-10  5:59 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #14 from truedfx at gentoo dot org  2010-08-10 05:59 -------
In the original code, the patch fixes the problem too. Thanks again.


-- 


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


^ permalink raw reply	[flat|nested] 27+ messages in thread

* [Bug target/45234] [4.4/4.5/4.6 Regression] ICE in expand_call, at calls.c:2845 when passing aligned function argument from unaligned stack after alloca
  2010-08-08 21:04 [Bug c/45234] New: ICE in expand_call, at calls.c:2845 when passing aligned function argument from unaligned stack after alloca truedfx at gentoo dot org
                   ` (14 preceding siblings ...)
  2010-08-10  5:59 ` truedfx at gentoo dot org
@ 2010-08-10  9:00 ` rguenth at gcc dot gnu dot org
  2010-08-10 13:37 ` [Bug middle-end/45234] " hjl dot tools at gmail dot com
                   ` (9 subsequent siblings)
  25 siblings, 0 replies; 27+ messages in thread
From: rguenth at gcc dot gnu dot org @ 2010-08-10  9:00 UTC (permalink / raw)
  To: gcc-bugs



-- 

rguenth at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
            Summary|[4.4 Regression] ICE in     |[4.4/4.5/4.6 Regression] ICE
                   |expand_call, at calls.c:2845|in expand_call, at
                   |when passing aligned        |calls.c:2845 when passing
                   |function argument from      |aligned function argument
                   |unaligned stack after alloca|from unaligned stack after
                   |                            |alloca
   Target Milestone|---                         |4.4.5


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


^ permalink raw reply	[flat|nested] 27+ messages in thread

* [Bug middle-end/45234] [4.4/4.5/4.6 Regression] ICE in expand_call, at calls.c:2845 when passing aligned function argument from unaligned stack after alloca
  2010-08-08 21:04 [Bug c/45234] New: ICE in expand_call, at calls.c:2845 when passing aligned function argument from unaligned stack after alloca truedfx at gentoo dot org
                   ` (15 preceding siblings ...)
  2010-08-10  9:00 ` [Bug target/45234] [4.4/4.5/4.6 " rguenth at gcc dot gnu dot org
@ 2010-08-10 13:37 ` hjl dot tools at gmail dot com
  2010-08-30 15:53 ` rguenth at gcc dot gnu dot org
                   ` (8 subsequent siblings)
  25 siblings, 0 replies; 27+ messages in thread
From: hjl dot tools at gmail dot com @ 2010-08-10 13:37 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #15 from hjl dot tools at gmail dot com  2010-08-10 13:36 -------
A patch is posted at

http://gcc.gnu.org/ml/gcc-patches/2010-08/msg00734.html


-- 

hjl dot tools at gmail dot com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                URL|                            |http://gcc.gnu.org/ml/gcc-
                   |                            |patches/2010-
                   |                            |08/msg00734.html
          Component|target                      |middle-end


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


^ permalink raw reply	[flat|nested] 27+ messages in thread

* [Bug middle-end/45234] [4.4/4.5/4.6 Regression] ICE in expand_call, at calls.c:2845 when passing aligned function argument from unaligned stack after alloca
  2010-08-08 21:04 [Bug c/45234] New: ICE in expand_call, at calls.c:2845 when passing aligned function argument from unaligned stack after alloca truedfx at gentoo dot org
                   ` (16 preceding siblings ...)
  2010-08-10 13:37 ` [Bug middle-end/45234] " hjl dot tools at gmail dot com
@ 2010-08-30 15:53 ` rguenth at gcc dot gnu dot org
  2010-09-06 18:40 ` howarth at nitro dot med dot uc dot edu
                   ` (7 subsequent siblings)
  25 siblings, 0 replies; 27+ messages in thread
From: rguenth at gcc dot gnu dot org @ 2010-08-30 15:53 UTC (permalink / raw)
  To: gcc-bugs



-- 

rguenth at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Priority|P3                          |P2


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


^ permalink raw reply	[flat|nested] 27+ messages in thread

* [Bug middle-end/45234] [4.4/4.5/4.6 Regression] ICE in expand_call, at calls.c:2845 when passing aligned function argument from unaligned stack after alloca
  2010-08-08 21:04 [Bug c/45234] New: ICE in expand_call, at calls.c:2845 when passing aligned function argument from unaligned stack after alloca truedfx at gentoo dot org
                   ` (17 preceding siblings ...)
  2010-08-30 15:53 ` rguenth at gcc dot gnu dot org
@ 2010-09-06 18:40 ` howarth at nitro dot med dot uc dot edu
  2010-09-17 18:01 ` hjl at gcc dot gnu dot org
                   ` (6 subsequent siblings)
  25 siblings, 0 replies; 27+ messages in thread
From: howarth at nitro dot med dot uc dot edu @ 2010-09-06 18:40 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #16 from howarth at nitro dot med dot uc dot edu  2010-09-06 18:40 -------
Still present for x86_64-unknown-gnu-linux with -m32 at r163927 when tested on
x86_64 Fedora 10
using the new gcc/gcc/testsuite/gcc.dg/torture/stackalign/alloca-5.c  test case
only from gcc-pr45234-2.patch.


-- 


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


^ permalink raw reply	[flat|nested] 27+ messages in thread

* [Bug middle-end/45234] [4.4/4.5/4.6 Regression] ICE in expand_call, at calls.c:2845 when passing aligned function argument from unaligned stack after alloca
  2010-08-08 21:04 [Bug c/45234] New: ICE in expand_call, at calls.c:2845 when passing aligned function argument from unaligned stack after alloca truedfx at gentoo dot org
                   ` (18 preceding siblings ...)
  2010-09-06 18:40 ` howarth at nitro dot med dot uc dot edu
@ 2010-09-17 18:01 ` hjl at gcc dot gnu dot org
  2010-09-18 20:51 ` sezeroz at gmail dot com
                   ` (5 subsequent siblings)
  25 siblings, 0 replies; 27+ messages in thread
From: hjl at gcc dot gnu dot org @ 2010-09-17 18:01 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #17 from hjl at gcc dot gnu dot org  2010-09-17 18:00 -------
Subject: Bug 45234

Author: hjl
Date: Fri Sep 17 18:00:40 2010
New Revision: 164377

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=164377
Log:
Make sure that all variable sized adjustments are multiple of preferred
stack boundary after stack alignment.

gcc/

2010-09-17  H.J. Lu  <hongjiu.lu@intel.com>

        PR middle-end/45234
        * calls.c (expand_call): Make sure that all variable sized
        adjustments are multiple of preferred stack boundary after
        stack alignment.

gcc/testsuite/

2010-09-17  H.J. Lu  <hongjiu.lu@intel.com>

        PR middle-end/45234
        * gcc.dg/torture/stackalign/alloca-5.c: New.

Added:
    trunk/gcc/testsuite/gcc.dg/torture/stackalign/alloca-5.c
Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/calls.c
    trunk/gcc/testsuite/ChangeLog


-- 


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


^ permalink raw reply	[flat|nested] 27+ messages in thread

* [Bug middle-end/45234] [4.4/4.5/4.6 Regression] ICE in expand_call, at calls.c:2845 when passing aligned function argument from unaligned stack after alloca
  2010-08-08 21:04 [Bug c/45234] New: ICE in expand_call, at calls.c:2845 when passing aligned function argument from unaligned stack after alloca truedfx at gentoo dot org
                   ` (19 preceding siblings ...)
  2010-09-17 18:01 ` hjl at gcc dot gnu dot org
@ 2010-09-18 20:51 ` sezeroz at gmail dot com
  2010-09-20 20:33 ` hjl at gcc dot gnu dot org
                   ` (4 subsequent siblings)
  25 siblings, 0 replies; 27+ messages in thread
From: sezeroz at gmail dot com @ 2010-09-18 20:51 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #18 from sezeroz at gmail dot com  2010-09-18 20:51 -------
Are 4.4 and 4.5 going to be fixed?


-- 


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


^ permalink raw reply	[flat|nested] 27+ messages in thread

* [Bug middle-end/45234] [4.4/4.5/4.6 Regression] ICE in expand_call, at calls.c:2845 when passing aligned function argument from unaligned stack after alloca
  2010-08-08 21:04 [Bug c/45234] New: ICE in expand_call, at calls.c:2845 when passing aligned function argument from unaligned stack after alloca truedfx at gentoo dot org
                   ` (20 preceding siblings ...)
  2010-09-18 20:51 ` sezeroz at gmail dot com
@ 2010-09-20 20:33 ` hjl at gcc dot gnu dot org
  2010-09-20 20:39 ` hjl at gcc dot gnu dot org
                   ` (3 subsequent siblings)
  25 siblings, 0 replies; 27+ messages in thread
From: hjl at gcc dot gnu dot org @ 2010-09-20 20:33 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #19 from hjl at gcc dot gnu dot org  2010-09-20 20:32 -------
Subject: Bug 45234

Author: hjl
Date: Mon Sep 20 20:32:41 2010
New Revision: 164453

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=164453
Log:
Make sure that all variable sized adjustments are multiple of preferred
stack boundary after stack alignment.

gcc/

2010-09-20  H.J. Lu  <hongjiu.lu@intel.com>

        Backport from mainline
        2010-09-17  H.J. Lu  <hongjiu.lu@intel.com>

        PR middle-end/45234
        * calls.c (expand_call): Make sure that all variable sized
        adjustments are multiple of preferred stack boundary after
        stack alignment.

gcc/testsuite/

2010-09-20  H.J. Lu  <hongjiu.lu@intel.com>

        Backport from mainline
        2010-09-17  H.J. Lu  <hongjiu.lu@intel.com>

        PR middle-end/45234
        * gcc.dg/torture/stackalign/alloca-5.c: New.

Added:
    branches/gcc-4_4-branch/gcc/testsuite/gcc.dg/torture/stackalign/alloca-5.c
Modified:
    branches/gcc-4_4-branch/gcc/ChangeLog
    branches/gcc-4_4-branch/gcc/calls.c
    branches/gcc-4_4-branch/gcc/testsuite/ChangeLog


-- 


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


^ permalink raw reply	[flat|nested] 27+ messages in thread

* [Bug middle-end/45234] [4.4/4.5/4.6 Regression] ICE in expand_call, at calls.c:2845 when passing aligned function argument from unaligned stack after alloca
  2010-08-08 21:04 [Bug c/45234] New: ICE in expand_call, at calls.c:2845 when passing aligned function argument from unaligned stack after alloca truedfx at gentoo dot org
                   ` (21 preceding siblings ...)
  2010-09-20 20:33 ` hjl at gcc dot gnu dot org
@ 2010-09-20 20:39 ` hjl at gcc dot gnu dot org
  2010-09-20 20:40 ` hjl dot tools at gmail dot com
                   ` (2 subsequent siblings)
  25 siblings, 0 replies; 27+ messages in thread
From: hjl at gcc dot gnu dot org @ 2010-09-20 20:39 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #20 from hjl at gcc dot gnu dot org  2010-09-20 20:39 -------
Subject: Bug 45234

Author: hjl
Date: Mon Sep 20 20:39:18 2010
New Revision: 164455

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=164455
Log:
Make sure that all variable sized adjustments are multiple of preferred
stack boundary after stack alignment.

gcc/

2010-09-20  H.J. Lu  <hongjiu.lu@intel.com>

        Backport from mainline
        2010-09-17  H.J. Lu  <hongjiu.lu@intel.com>

        PR middle-end/45234
        * calls.c (expand_call): Make sure that all variable sized
        adjustments are multiple of preferred stack boundary after
        stack alignment.

gcc/testsuite/

2010-09-20  H.J. Lu  <hongjiu.lu@intel.com>

        Backport from mainline
        2010-09-17  H.J. Lu  <hongjiu.lu@intel.com>

        PR middle-end/45234
        * gcc.dg/torture/stackalign/alloca-5.c: New.

Added:
    branches/gcc-4_5-branch/gcc/testsuite/gcc.dg/torture/stackalign/alloca-5.c
Modified:
    branches/gcc-4_5-branch/gcc/ChangeLog
    branches/gcc-4_5-branch/gcc/calls.c
    branches/gcc-4_5-branch/gcc/testsuite/ChangeLog


-- 


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


^ permalink raw reply	[flat|nested] 27+ messages in thread

* [Bug middle-end/45234] [4.4/4.5/4.6 Regression] ICE in expand_call, at calls.c:2845 when passing aligned function argument from unaligned stack after alloca
  2010-08-08 21:04 [Bug c/45234] New: ICE in expand_call, at calls.c:2845 when passing aligned function argument from unaligned stack after alloca truedfx at gentoo dot org
                   ` (22 preceding siblings ...)
  2010-09-20 20:39 ` hjl at gcc dot gnu dot org
@ 2010-09-20 20:40 ` hjl dot tools at gmail dot com
  2010-09-22 17:24 ` jakub at gcc dot gnu dot org
  2010-09-22 21:36 ` hjl dot tools at gmail dot com
  25 siblings, 0 replies; 27+ messages in thread
From: hjl dot tools at gmail dot com @ 2010-09-20 20:40 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #21 from hjl dot tools at gmail dot com  2010-09-20 20:40 -------
Fixed.


-- 

hjl dot tools at gmail dot com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |FIXED


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


^ permalink raw reply	[flat|nested] 27+ messages in thread

* [Bug middle-end/45234] [4.4/4.5/4.6 Regression] ICE in expand_call, at calls.c:2845 when passing aligned function argument from unaligned stack after alloca
  2010-08-08 21:04 [Bug c/45234] New: ICE in expand_call, at calls.c:2845 when passing aligned function argument from unaligned stack after alloca truedfx at gentoo dot org
                   ` (23 preceding siblings ...)
  2010-09-20 20:40 ` hjl dot tools at gmail dot com
@ 2010-09-22 17:24 ` jakub at gcc dot gnu dot org
  2010-09-22 21:36 ` hjl dot tools at gmail dot com
  25 siblings, 0 replies; 27+ messages in thread
From: jakub at gcc dot gnu dot org @ 2010-09-22 17:24 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #22 from jakub at gcc dot gnu dot org  2010-09-22 17:24 -------
The 4.5/4.4 backports of this patch break:
/* { dg-do compile } */
/* { dg-options "-march=i586" { target ilp32 } } */

struct S { union { double b[4]; } a[18]; } s, a[5];
void foo (struct S);
struct S bar (struct S, struct S *, struct S);

void
foo (struct S arg)
{
}

void
baz (void)
{
  foo (bar (s, &a[1], a[2]));
}

(distilled from struct-layout-1.exp tests, many of them fail).  Please either
fix soon, or revert the patch.  I'd like to roll 4.4.5 RC1 soon, but with this
kind of regression it is not possible.


-- 

jakub at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|RESOLVED                    |REOPENED
           Priority|P2                          |P1
         Resolution|FIXED                       |


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


^ permalink raw reply	[flat|nested] 27+ messages in thread

* [Bug middle-end/45234] [4.4/4.5/4.6 Regression] ICE in expand_call, at calls.c:2845 when passing aligned function argument from unaligned stack after alloca
  2010-08-08 21:04 [Bug c/45234] New: ICE in expand_call, at calls.c:2845 when passing aligned function argument from unaligned stack after alloca truedfx at gentoo dot org
                   ` (24 preceding siblings ...)
  2010-09-22 17:24 ` jakub at gcc dot gnu dot org
@ 2010-09-22 21:36 ` hjl dot tools at gmail dot com
  25 siblings, 0 replies; 27+ messages in thread
From: hjl dot tools at gmail dot com @ 2010-09-22 21:36 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #23 from hjl dot tools at gmail dot com  2010-09-22 21:36 -------
(In reply to comment #22)
> The 4.5/4.4 backports of this patch break:
> /* { dg-do compile } */
> /* { dg-options "-march=i586" { target ilp32 } } */
> 
> struct S { union { double b[4]; } a[18]; } s, a[5];
> void foo (struct S);
> struct S bar (struct S, struct S *, struct S);
> 
> void
> foo (struct S arg)
> {
> }
> 
> void
> baz (void)
> {
>   foo (bar (s, &a[1], a[2]));
> }

We are trying to adjust stacking when calling builtin functions. This patch
works for me:

index aef823f..0c7588a 100644
--- a/gcc/calls.c
+++ b/gcc/calls.c
@@ -2369,7 +2369,7 @@ expand_call (tree exp, rtx target, int ignore)

   preferred_unit_stack_boundary = preferred_stack_boundary / BITS_PER_UNIT;

-  if (SUPPORTS_STACK_ALIGNMENT)
+  if (SUPPORTS_STACK_ALIGNMENT && fndecl && !DECL_IS_BUILTIN (fndecl))
     {
       /* All variable sized adjustments must be multiple of preferred
         stack boundary.  Stack alignment may change preferred stack


-- 


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


^ permalink raw reply	[flat|nested] 27+ messages in thread

end of thread, other threads:[~2010-09-22 21:36 UTC | newest]

Thread overview: 27+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-08-08 21:04 [Bug c/45234] New: ICE in expand_call, at calls.c:2845 when passing aligned function argument from unaligned stack after alloca truedfx at gentoo dot org
2010-08-08 22:01 ` [Bug target/45234] " rguenth at gcc dot gnu dot org
2010-08-08 22:45 ` truedfx at gentoo dot org
2010-08-08 23:10 ` truedfx at gentoo dot org
2010-08-09 15:24 ` ubizjak at gmail dot com
2010-08-09 15:51 ` hjl dot tools at gmail dot com
2010-08-09 16:04 ` [Bug target/45234] [4.4 Regression] " rguenth at gcc dot gnu dot org
2010-08-09 16:16 ` truedfx at gentoo dot org
2010-08-09 16:19 ` hjl dot tools at gmail dot com
2010-08-09 16:29 ` hjl dot tools at gmail dot com
2010-08-09 16:39 ` hjl dot tools at gmail dot com
2010-08-09 16:58 ` truedfx at gentoo dot org
2010-08-09 17:01 ` hjl dot tools at gmail dot com
2010-08-09 17:24 ` hjl dot tools at gmail dot com
2010-08-09 17:44 ` truedfx at gentoo dot org
2010-08-10  5:59 ` truedfx at gentoo dot org
2010-08-10  9:00 ` [Bug target/45234] [4.4/4.5/4.6 " rguenth at gcc dot gnu dot org
2010-08-10 13:37 ` [Bug middle-end/45234] " hjl dot tools at gmail dot com
2010-08-30 15:53 ` rguenth at gcc dot gnu dot org
2010-09-06 18:40 ` howarth at nitro dot med dot uc dot edu
2010-09-17 18:01 ` hjl at gcc dot gnu dot org
2010-09-18 20:51 ` sezeroz at gmail dot com
2010-09-20 20:33 ` hjl at gcc dot gnu dot org
2010-09-20 20:39 ` hjl at gcc dot gnu dot org
2010-09-20 20:40 ` hjl dot tools at gmail dot com
2010-09-22 17:24 ` jakub at gcc dot gnu dot org
2010-09-22 21:36 ` hjl dot tools at gmail dot com

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).