public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug target/43668]  New: -fschedule-insns causes FAIL: gcc.target/i386/vararg-1.c execution test
@ 2010-04-06 15:37 zsojka at seznam dot cz
  2010-04-06 15:53 ` [Bug target/43668] " rguenth at gcc dot gnu dot org
                   ` (9 more replies)
  0 siblings, 10 replies; 11+ messages in thread
From: zsojka at seznam dot cz @ 2010-04-06 15:37 UTC (permalink / raw)
  To: gcc-bugs

Command line:
gcc -fschedule-insns vararg-1.c && ./a.out

Testcase can be further reduced to:
----------- testcase.c -----------
int foo(int i, ...) {
  return i;
}
int main() {
  return foo(0, 0.0);
}
----------------------------------
I am not sure the testcase is valid, but I can't find any proof it isn't.
"If access to the varying arguments is desired, the called function shall
declare an object (...) having type va_list." is the most related sentence in
the C99 TC3 draft, but it doesn't say what to do when 'access to varying
arguments isn't desired'.

Tested revisions:
r157965 - crash
4.4.3 - crash
4.3.4, 4.2.4, 4.1.2, 3.4.6, 3.3.6 - OK

Output:
$ gcc-4.5.0-alpha20100401 -fschedule-insns testcase.c && ./a.out
Segmentation fault

The problem is unaligned access with movaps:
foo:
        pushq   %rbp    #
        movq    %rsp, %rbp      #,
        pushq   %rbx    #
        subq    $64, %rsp       #,
        movzbl  %al, %eax       #, tmp61
        leaq    -9(%rbp), %rbx  #, tmp62
...
        movaps  %xmm0, -127(%rbx)       #,
access is aligned to 8-byte boundary, not 16-byte

when -fschedule-insns is not used, "leaq -9(%rbp), %rbx" is changed to "leaq
-1(%rbp), %rdx", and the access is aligned correctly


-- 
           Summary: -fschedule-insns causes FAIL: gcc.target/i386/vararg-1.c
                    execution test
           Product: gcc
           Version: 4.5.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: target
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: zsojka at seznam dot cz
  GCC host triplet: x86_64-pc-linux-gnu
GCC target triplet: x86_64-pc-linux-gnu


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


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

* [Bug target/43668] -fschedule-insns causes FAIL: gcc.target/i386/vararg-1.c execution test
  2010-04-06 15:37 [Bug target/43668] New: -fschedule-insns causes FAIL: gcc.target/i386/vararg-1.c execution test zsojka at seznam dot cz
@ 2010-04-06 15:53 ` rguenth at gcc dot gnu dot org
  2010-04-07  5:42 ` [Bug target/43668] [4.4/4.5 Regression] " hjl dot tools at gmail dot com
                   ` (8 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: rguenth at gcc dot gnu dot org @ 2010-04-06 15:53 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #1 from rguenth at gcc dot gnu dot org  2010-04-06 15:53 -------
Confirmed.  We end up using the callee saved reg %rbx and thus need to push it
but we do not preserve alignment correctly.


-- 

rguenth at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |hjl at gcc dot gnu dot org
             Status|UNCONFIRMED                 |NEW
     Ever Confirmed|0                           |1
           Keywords|                            |wrong-code
   Last reconfirmed|0000-00-00 00:00:00         |2010-04-06 15:53:27
               date|                            |


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


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

* [Bug target/43668] [4.4/4.5 Regression] -fschedule-insns causes FAIL: gcc.target/i386/vararg-1.c execution test
  2010-04-06 15:37 [Bug target/43668] New: -fschedule-insns causes FAIL: gcc.target/i386/vararg-1.c execution test zsojka at seznam dot cz
  2010-04-06 15:53 ` [Bug target/43668] " rguenth at gcc dot gnu dot org
@ 2010-04-07  5:42 ` hjl dot tools at gmail dot com
  2010-04-07  5:59 ` hjl dot tools at gmail dot com
                   ` (7 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: hjl dot tools at gmail dot com @ 2010-04-07  5:42 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #2 from hjl dot tools at gmail dot com  2010-04-07 05:42 -------
i386.c has

     tmp_reg = gen_reg_rtx (Pmode);
      emit_insn (gen_rtx_SET (VOIDmode, tmp_reg,
                              plus_constant (save_area,
                                             ix86_varargs_gpr_size + 127)));
      mem = gen_rtx_MEM (BLKmode, plus_constant (tmp_reg, -127));
      MEM_NOTRAP_P (mem) = 1;
      set_mem_alias_set (mem, set);
      set_mem_align (mem, BITS_PER_WORD);

      /* And finally do the dirty job!  */
      emit_insn (gen_sse_prologue_save (mem, nsse_reg,
                                        GEN_INT (cum->sse_regno), label));

We pass 64bit aligned memory to sse_prologue_save_insn which
uses movaps on 64bit aligned memory.


-- 


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


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

* [Bug target/43668] [4.4/4.5 Regression] -fschedule-insns causes FAIL: gcc.target/i386/vararg-1.c execution test
  2010-04-06 15:37 [Bug target/43668] New: -fschedule-insns causes FAIL: gcc.target/i386/vararg-1.c execution test zsojka at seznam dot cz
  2010-04-06 15:53 ` [Bug target/43668] " rguenth at gcc dot gnu dot org
  2010-04-07  5:42 ` [Bug target/43668] [4.4/4.5 Regression] " hjl dot tools at gmail dot com
@ 2010-04-07  5:59 ` hjl dot tools at gmail dot com
  2010-04-07 14:57 ` [Bug target/43668] [4.4/4.5/4.6 " rguenth at gcc dot gnu dot org
                   ` (6 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: hjl dot tools at gmail dot com @ 2010-04-07  5:59 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #3 from hjl dot tools at gmail dot com  2010-04-07 05:59 -------
A patch is posted at

http://gcc.gnu.org/ml/gcc-patches/2010-04/msg00229.html


-- 

hjl dot tools at gmail dot com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |ubizjak at gmail dot com
                URL|                            |http://gcc.gnu.org/ml/gcc-
                   |                            |patches/2010-
                   |                            |04/msg00229.html


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


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

* [Bug target/43668] [4.4/4.5/4.6 Regression] -fschedule-insns causes FAIL: gcc.target/i386/vararg-1.c execution test
  2010-04-06 15:37 [Bug target/43668] New: -fschedule-insns causes FAIL: gcc.target/i386/vararg-1.c execution test zsojka at seznam dot cz
                   ` (2 preceding siblings ...)
  2010-04-07  5:59 ` hjl dot tools at gmail dot com
@ 2010-04-07 14:57 ` rguenth at gcc dot gnu dot org
  2010-04-07 21:49 ` hjl at gcc dot gnu dot org
                   ` (5 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: rguenth at gcc dot gnu dot org @ 2010-04-07 14:57 UTC (permalink / raw)
  To: gcc-bugs



-- 

rguenth at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|---                         |4.4.4


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


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

* [Bug target/43668] [4.4/4.5/4.6 Regression] -fschedule-insns causes FAIL: gcc.target/i386/vararg-1.c execution test
  2010-04-06 15:37 [Bug target/43668] New: -fschedule-insns causes FAIL: gcc.target/i386/vararg-1.c execution test zsojka at seznam dot cz
                   ` (3 preceding siblings ...)
  2010-04-07 14:57 ` [Bug target/43668] [4.4/4.5/4.6 " rguenth at gcc dot gnu dot org
@ 2010-04-07 21:49 ` hjl at gcc dot gnu dot org
  2010-04-07 21:58 ` hjl at gcc dot gnu dot org
                   ` (4 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: hjl at gcc dot gnu dot org @ 2010-04-07 21:49 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #4 from hjl at gcc dot gnu dot org  2010-04-07 21:49 -------
Subject: Bug 43668

Author: hjl
Date: Wed Apr  7 21:48:51 2010
New Revision: 158092

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=158092
Log:
Align stack to 16byte for FP register save area.

gcc/

2010-04-06  H.J. Lu  <hongjiu.lu@intel.com>

        PR target/43668
        * config/i386/i386.c (setup_incoming_varargs_64): Align stack to
        16byte for FP register save area.

gcc/testsuite/

2010-04-06  H.J. Lu  <hongjiu.lu@intel.com>

        PR target/43668
        * gcc.target/i386/pr43668.c: New.

Added:
    branches/gcc-4_4-branch/gcc/testsuite/gcc.target/i386/pr43668.c
Modified:
    branches/gcc-4_4-branch/gcc/ChangeLog
    branches/gcc-4_4-branch/gcc/config/i386/i386.c
    branches/gcc-4_4-branch/gcc/testsuite/ChangeLog


-- 


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


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

* [Bug target/43668] [4.4/4.5/4.6 Regression] -fschedule-insns causes FAIL: gcc.target/i386/vararg-1.c execution test
  2010-04-06 15:37 [Bug target/43668] New: -fschedule-insns causes FAIL: gcc.target/i386/vararg-1.c execution test zsojka at seznam dot cz
                   ` (4 preceding siblings ...)
  2010-04-07 21:49 ` hjl at gcc dot gnu dot org
@ 2010-04-07 21:58 ` hjl at gcc dot gnu dot org
  2010-04-09 13:03 ` [Bug target/43668] [4.6 " rguenth at gcc dot gnu dot org
                   ` (3 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: hjl at gcc dot gnu dot org @ 2010-04-07 21:58 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #5 from hjl at gcc dot gnu dot org  2010-04-07 21:58 -------
Subject: Bug 43668

Author: hjl
Date: Wed Apr  7 21:58:27 2010
New Revision: 158093

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=158093
Log:
Align stack to 16byte for FP register save area.

gcc/

2010-04-07  H.J. Lu  <hongjiu.lu@intel.com>

        PR target/43668
        * config/i386/i386.c (setup_incoming_varargs_64): Align stack to
        16byte for FP register save area.

gcc/testsuite/

2010-04-07  H.J. Lu  <hongjiu.lu@intel.com>

        PR target/43668
        * gcc.target/i386/pr43668.c: New.

Modified:
    branches/gcc-4_5-branch/gcc/ChangeLog
    branches/gcc-4_5-branch/gcc/config/i386/i386.c
    branches/gcc-4_5-branch/gcc/testsuite/ChangeLog


-- 


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


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

* [Bug target/43668] [4.6 Regression] -fschedule-insns causes FAIL: gcc.target/i386/vararg-1.c execution test
  2010-04-06 15:37 [Bug target/43668] New: -fschedule-insns causes FAIL: gcc.target/i386/vararg-1.c execution test zsojka at seznam dot cz
                   ` (5 preceding siblings ...)
  2010-04-07 21:58 ` hjl at gcc dot gnu dot org
@ 2010-04-09 13:03 ` rguenth at gcc dot gnu dot org
  2010-04-30  8:57 ` jakub at gcc dot gnu dot org
                   ` (2 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: rguenth at gcc dot gnu dot org @ 2010-04-09 13:03 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #6 from rguenth at gcc dot gnu dot org  2010-04-09 13:02 -------
Trunk patch still pending.


-- 

rguenth at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
      Known to fail|4.4.3 4.5.0                 |4.4.3
      Known to work|3.3.6 3.4.6 4.1.2 4.2.4     |3.3.6 3.4.6 4.1.2 4.2.4
                   |4.3.4                       |4.3.4 4.4.4 4.5.0
           Priority|P3                          |P2
            Summary|[4.4/4.5/4.6 Regression] -  |[4.6 Regression] -fschedule-
                   |fschedule-insns causes FAIL:|insns causes FAIL:
                   |gcc.target/i386/vararg-1.c  |gcc.target/i386/vararg-1.c
                   |execution test              |execution test


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


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

* [Bug target/43668] [4.6 Regression] -fschedule-insns causes FAIL: gcc.target/i386/vararg-1.c execution test
  2010-04-06 15:37 [Bug target/43668] New: -fschedule-insns causes FAIL: gcc.target/i386/vararg-1.c execution test zsojka at seznam dot cz
                   ` (6 preceding siblings ...)
  2010-04-09 13:03 ` [Bug target/43668] [4.6 " rguenth at gcc dot gnu dot org
@ 2010-04-30  8:57 ` jakub at gcc dot gnu dot org
  2010-05-04 21:16 ` hjl at gcc dot gnu dot org
  2010-05-04 21:23 ` hjl dot tools at gmail dot com
  9 siblings, 0 replies; 11+ messages in thread
From: jakub at gcc dot gnu dot org @ 2010-04-30  8:57 UTC (permalink / raw)
  To: gcc-bugs



-- 

jakub at gcc dot gnu dot org changed:

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


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


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

* [Bug target/43668] [4.6 Regression] -fschedule-insns causes FAIL: gcc.target/i386/vararg-1.c execution test
  2010-04-06 15:37 [Bug target/43668] New: -fschedule-insns causes FAIL: gcc.target/i386/vararg-1.c execution test zsojka at seznam dot cz
                   ` (7 preceding siblings ...)
  2010-04-30  8:57 ` jakub at gcc dot gnu dot org
@ 2010-05-04 21:16 ` hjl at gcc dot gnu dot org
  2010-05-04 21:23 ` hjl dot tools at gmail dot com
  9 siblings, 0 replies; 11+ messages in thread
From: hjl at gcc dot gnu dot org @ 2010-05-04 21:16 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #7 from hjl at gcc dot gnu dot org  2010-05-04 21:15 -------
Subject: Bug 43668

Author: hjl
Date: Tue May  4 21:15:35 2010
New Revision: 159046

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=159046
Log:
Add a testcase for PR target/43668.

2010-05-04  H.J. Lu  <hongjiu.lu@intel.com>

        PR target/43668
        * gcc.target/i386/pr43668.c: New.

Added:
    trunk/gcc/testsuite/gcc.target/i386/pr43668.c
Modified:
    trunk/gcc/testsuite/ChangeLog


-- 


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


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

* [Bug target/43668] [4.6 Regression] -fschedule-insns causes FAIL: gcc.target/i386/vararg-1.c execution test
  2010-04-06 15:37 [Bug target/43668] New: -fschedule-insns causes FAIL: gcc.target/i386/vararg-1.c execution test zsojka at seznam dot cz
                   ` (8 preceding siblings ...)
  2010-05-04 21:16 ` hjl at gcc dot gnu dot org
@ 2010-05-04 21:23 ` hjl dot tools at gmail dot com
  9 siblings, 0 replies; 11+ messages in thread
From: hjl dot tools at gmail dot com @ 2010-05-04 21:23 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #8 from hjl dot tools at gmail dot com  2010-05-04 21:22 -------
Fixed by

http://gcc.gnu.org/ml/gcc-cvs/2010-04/msg00589.html
http://gcc.gnu.org/ml/gcc-cvs/2010-05/msg00089.html

on trunk.


-- 

hjl dot tools at gmail dot com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
      Known to work|3.3.6 3.4.6 4.1.2 4.2.4     |3.3.6 3.4.6 4.1.2 4.2.4
                   |4.3.4 4.4.4 4.5.0           |4.3.4 4.4.4 4.5.0 4.6.0
         Resolution|                            |FIXED


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


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

end of thread, other threads:[~2010-05-04 21:23 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-04-06 15:37 [Bug target/43668] New: -fschedule-insns causes FAIL: gcc.target/i386/vararg-1.c execution test zsojka at seznam dot cz
2010-04-06 15:53 ` [Bug target/43668] " rguenth at gcc dot gnu dot org
2010-04-07  5:42 ` [Bug target/43668] [4.4/4.5 Regression] " hjl dot tools at gmail dot com
2010-04-07  5:59 ` hjl dot tools at gmail dot com
2010-04-07 14:57 ` [Bug target/43668] [4.4/4.5/4.6 " rguenth at gcc dot gnu dot org
2010-04-07 21:49 ` hjl at gcc dot gnu dot org
2010-04-07 21:58 ` hjl at gcc dot gnu dot org
2010-04-09 13:03 ` [Bug target/43668] [4.6 " rguenth at gcc dot gnu dot org
2010-04-30  8:57 ` jakub at gcc dot gnu dot org
2010-05-04 21:16 ` hjl at gcc dot gnu dot org
2010-05-04 21:23 ` 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).