public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "dannysmith at users dot sourceforge dot net" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug target/38130]  New: [4.4.0 regression]__builtin_alloca (vs IRA?)  testsuite failures on  mingw32
Date: Sat, 15 Nov 2008 09:27:00 -0000	[thread overview]
Message-ID: <bug-38130-4066@http.gcc.gnu.org/bugzilla/> (raw)

Execution testcases c-torture/execute/920929-1.c and
c-torture/execute/built-in-setjmp.c began failing on mingw32 in late August,
coincident with merge of IRA into trunk. 

In both cases, the execution tests pass if -fno-ira is added to command line.

The problem appears to be in the call of the target stack-probing code
(__chkstk) in cygwin.asm from allocate_stack_worker instruction. __chkstk has
unusual calling convention, with the input argument as well as the
output passed in eax.

>From i386.md:

(define_insn "allocate_stack_worker_32"
  [(set (match_operand:SI 0 "register_operand" "+a")
        (unspec_volatile:SI [(match_dup 0)] UNSPECV_STACK_PROBE))
   (set (reg:SI SP_REG) (minus:SI (reg:SI SP_REG) (match_dup 0)))
   (clobber (reg:CC FLAGS_REG))]
  "!TARGET_64BIT && TARGET_STACK_PROBE"
  "call\t___chkstk"
  [(set_attr "type" "multi")
   (set_attr "length" "5")])


The relevant part of the output of 
gcc  -S  -O -funroll-all-loops  920929-1.c -o 920929-1-IRA.s:

f:
        pushl   %ebp
        movl    %esp, %ebp
        pushl   %ebx
        subl    $4, %esp
        movl    8(%ebp), %edx
        call    ___chkstk
        leal    15(%esp), %ecx
        andl    $-16, %ecx
        testl   %edx, %edx
        ...

__chkstk allocates only 1 byte and the code segfault on the first
attempt to assign a double to the allocated array.


The output, with -fno-ira 
gcc  -S  -O -funroll-all-loops -fno-ira 920929-1.c -o 920929-1-NOIRA.s:
_f:
        pushl   %ebp
        movl    %esp, %ebp
        pushl   %ebx
        subl    $4, %esp
        movl    8(%ebp), %ebx
        leal    30(,%ebx,8), %eax
        andl    $-16, %eax
        call    ___chkstk
        leal    15(%esp), %eax
        movl    %eax, %edx
        andl    $-16, %edx
        testl   %ebx, %ebx

__chkstk allocates 816 bytes


A comparison of built-in-setjmp.c with amd without -fno-ira switch also shows
incorrect input to __chkstk

Probably related to these failure is miscompilation of the C++ compiler
code cp/pt.c, which segfaults following call to alloca in
process_partial_specialization when building libstdc++. If cp/pt.c is
compiled with -fno-ira, libstdc++ builds successfully.

Danny


-- 
           Summary: [4.4.0 regression]__builtin_alloca (vs IRA?)  testsuite
                    failures on  mingw32
           Product: gcc
           Version: 4.4.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: target
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: dannysmith at users dot sourceforge dot net
 GCC build triplet: i686-pc-mingw32
  GCC host triplet: i686-pc-mingw32
GCC target triplet: i686-pc-mingw32


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


             reply	other threads:[~2008-11-15  9:27 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-11-15  9:27 dannysmith at users dot sourceforge dot net [this message]
2008-11-16  2:52 ` [Bug target/38130] [4.4 " pinskia at gcc dot gnu dot org
2008-11-16  9:05 ` ktietz at gcc dot gnu dot org
2008-11-17  9:22 ` jakub at gcc dot gnu dot org
2008-11-17  9:36 ` jakub at gcc dot gnu dot org
2008-11-17 22:13 ` jakub at gcc dot gnu dot org
2008-11-17 22:30 ` jakub at gcc dot gnu dot org
2008-11-18  5:57 ` dannysmith at users dot sourceforge dot net
2008-11-18 12:36 ` jakub at gcc dot gnu dot org
2008-11-18 12:39 ` jakub at gcc dot gnu dot org

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bug-38130-4066@http.gcc.gnu.org/bugzilla/ \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).