public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug middle-end/17052] New: altivec varargs failure if no optimization
@ 2004-08-16 20:10 janis187 at us dot ibm dot com
  2004-08-16 20:11 ` [Bug middle-end/17052] " janis187 at us dot ibm dot com
                   ` (7 more replies)
  0 siblings, 8 replies; 9+ messages in thread
From: janis187 at us dot ibm dot com @ 2004-08-16 20:10 UTC (permalink / raw)
  To: gcc-bugs

Tests gcc.dg/altivec-[237].c fail with a seg fault trying to access
an integer argument that follows a vector float argument.  They fail
without optimization but pass when compiling with -O1 or any higher
level of optimization.  They fail for 32-bit code but not 64-bit code.
The failures begin with the tree-ssa merge.
                                                                                
The test case is extracted from altivec-2.c.  I last tested with
mainline sources as of Mon Aug 16 18:14:11 UTC 2004.

-- 
           Summary: altivec varargs failure if no optimization
           Product: gcc
           Version: 3.5.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: middle-end
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: janis187 at us dot ibm dot com
                CC: gcc-bugs at gcc dot gnu dot org
GCC target triplet: powerpc64-unknown-linux-gnu


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


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

* [Bug middle-end/17052] altivec varargs failure if no optimization
  2004-08-16 20:10 [Bug middle-end/17052] New: altivec varargs failure if no optimization janis187 at us dot ibm dot com
@ 2004-08-16 20:11 ` janis187 at us dot ibm dot com
  2004-08-16 20:52 ` [Bug middle-end/17052] [3.5 Regression] " pinskia at gcc dot gnu dot org
                   ` (6 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: janis187 at us dot ibm dot com @ 2004-08-16 20:11 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From janis187 at us dot ibm dot com  2004-08-16 20:11 -------
Created an attachment (id=6944)
 --> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=6944&action=view)
minimized test case


-- 


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


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

* [Bug middle-end/17052] [3.5 Regression] altivec varargs failure if no optimization
  2004-08-16 20:10 [Bug middle-end/17052] New: altivec varargs failure if no optimization janis187 at us dot ibm dot com
  2004-08-16 20:11 ` [Bug middle-end/17052] " janis187 at us dot ibm dot com
@ 2004-08-16 20:52 ` pinskia at gcc dot gnu dot org
  2004-08-16 21:08 ` janis187 at us dot ibm dot com
                   ` (5 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-08-16 20:52 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2004-08-16 20:52 -------
I should note that this works on powerpc-apple-darwin so it looks like an ABI problem.

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |ABI, wrong-code
            Summary|altivec varargs failure if  |[3.5 Regression] altivec
                   |no optimization             |varargs failure if no
                   |                            |optimization
   Target Milestone|---                         |3.5.0


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


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

* [Bug middle-end/17052] [3.5 Regression] altivec varargs failure if no optimization
  2004-08-16 20:10 [Bug middle-end/17052] New: altivec varargs failure if no optimization janis187 at us dot ibm dot com
  2004-08-16 20:11 ` [Bug middle-end/17052] " janis187 at us dot ibm dot com
  2004-08-16 20:52 ` [Bug middle-end/17052] [3.5 Regression] " pinskia at gcc dot gnu dot org
@ 2004-08-16 21:08 ` janis187 at us dot ibm dot com
  2004-08-23  7:58 ` amodra at bigpond dot net dot au
                   ` (4 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: janis187 at us dot ibm dot com @ 2004-08-16 21:08 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From janis187 at us dot ibm dot com  2004-08-16 21:08 -------
It works with -O1 and fails with -O0, so it must be deeper than getting the ABI
support wrong.  There were no changes to argument handling in the backend for
the tree-ssa merge and that when the tests started failing.

-- 


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


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

* [Bug middle-end/17052] [3.5 Regression] altivec varargs failure if no optimization
  2004-08-16 20:10 [Bug middle-end/17052] New: altivec varargs failure if no optimization janis187 at us dot ibm dot com
                   ` (2 preceding siblings ...)
  2004-08-16 21:08 ` janis187 at us dot ibm dot com
@ 2004-08-23  7:58 ` amodra at bigpond dot net dot au
  2004-08-23  8:47 ` amodra at bigpond dot net dot au
                   ` (3 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: amodra at bigpond dot net dot au @ 2004-08-23  7:58 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From amodra at bigpond dot net dot au  2004-08-23 07:58 -------
static int
varargsn001(vector float p1, ...)
{
    va_list ap;
    vector float i1;
    vector float i2;
    int i3;

    va_start(ap, p1);
    i1 = p1;

The real problem occurs with the above assignment to i1.

0x10000508 <varargsn001+120>:	li	r0,176
0x1000050c <varargsn001+124>:	lvx	v0,r31,r0
0x10000510 <varargsn001+128>:	li	r0,136
0x10000514 <varargsn001+132>:	stvx	v0,r31,r0

Notice that the stack slot for i1 isn't 16 byte aligned.  VMX load and
store insns silently ignore the bottom 4 bits of the address, so this
stores to sp+128 instead of sp+136.  It so happens that one element of
our va_list is at sp+128...

Bottom line: This is a problem with vector stack slot alignment.


-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
     Ever Confirmed|                            |1
   Last reconfirmed|0000-00-00 00:00:00         |2004-08-23 07:58:56
               date|                            |


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


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

* [Bug middle-end/17052] [3.5 Regression] altivec varargs failure if no optimization
  2004-08-16 20:10 [Bug middle-end/17052] New: altivec varargs failure if no optimization janis187 at us dot ibm dot com
                   ` (3 preceding siblings ...)
  2004-08-23  7:58 ` amodra at bigpond dot net dot au
@ 2004-08-23  8:47 ` amodra at bigpond dot net dot au
  2004-08-24 14:38 ` [Bug target/17052] " amodra at bigpond dot net dot au
                   ` (2 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: amodra at bigpond dot net dot au @ 2004-08-23  8:47 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From amodra at bigpond dot net dot au  2004-08-23 08:47 -------
And the reason for the stack slot problem is
#define STARTING_FRAME_OFFSET						\
  (RS6000_ALIGN (current_function_outgoing_args_size,			\
		 TARGET_ALTIVEC ? 16 : 8)				\
   + RS6000_VARARGS_AREA						\
   + RS6000_SAVE_AREA)

and
#define RS6000_VARARGS_AREA ((cfun->machine->sysv_varargs_p) ?
RS6000_VARARGS_SIZE : 0)

with sysv_varargs_p not being set until TARGET_SETUP_INCOMING_VARARGS is
called, but this is later than the stack slots are assigned.

See cfgexpand.c:tree_expand_cfg

  /* Expand the variables recorded during gimple lowering.  */
  expand_used_vars ();

  /* Set up parameters and prepare for return, for the function.  */
  expand_function_start (current_function_decl);

and note that setup_incoming_varargs is called via expand_function_start.

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
 GCC target triplet|powerpc64-unknown-linux-gnu |powerpc-unknown-linux-gnu


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


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

* [Bug target/17052] [3.5 Regression] altivec varargs failure if no optimization
  2004-08-16 20:10 [Bug middle-end/17052] New: altivec varargs failure if no optimization janis187 at us dot ibm dot com
                   ` (4 preceding siblings ...)
  2004-08-23  8:47 ` amodra at bigpond dot net dot au
@ 2004-08-24 14:38 ` amodra at bigpond dot net dot au
  2004-08-25  3:40 ` cvs-commit at gcc dot gnu dot org
  2004-08-25  3:46 ` amodra at bigpond dot net dot au
  7 siblings, 0 replies; 9+ messages in thread
From: amodra at bigpond dot net dot au @ 2004-08-24 14:38 UTC (permalink / raw)
  To: gcc-bugs



-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
         AssignedTo|unassigned at gcc dot gnu   |amodra at bigpond dot net
                   |dot org                     |dot au
             Status|NEW                         |ASSIGNED
          Component|middle-end                  |target
           Keywords|                            |patch


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


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

* [Bug target/17052] [3.5 Regression] altivec varargs failure if no optimization
  2004-08-16 20:10 [Bug middle-end/17052] New: altivec varargs failure if no optimization janis187 at us dot ibm dot com
                   ` (5 preceding siblings ...)
  2004-08-24 14:38 ` [Bug target/17052] " amodra at bigpond dot net dot au
@ 2004-08-25  3:40 ` cvs-commit at gcc dot gnu dot org
  2004-08-25  3:46 ` amodra at bigpond dot net dot au
  7 siblings, 0 replies; 9+ messages in thread
From: cvs-commit at gcc dot gnu dot org @ 2004-08-25  3:40 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From cvs-commit at gcc dot gnu dot org  2004-08-25 03:40 -------
Subject: Bug 17052

CVSROOT:	/cvs/gcc
Module name:	gcc
Changes by:	amodra@gcc.gnu.org	2004-08-25 03:40:28

Modified files:
	gcc            : ChangeLog 
	gcc/config/rs6000: sysv4.h rs6000.c rs6000.h 

Log message:
	PR target/17052
	* config/rs6000/rs6000.h (machine_function): Remove sysv_varargs_p.
	* config/rs6000/sysv4.h (RS6000_VARARGS_AREA): Use
	current_function_stdarg in place of sysv_varargs_p.
	* config/rs6000/rs6000.c (setup_incoming_varargs): Don't set
	sysv_varargs_p.

Patches:
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/ChangeLog.diff?cvsroot=gcc&r1=2.5075&r2=2.5076
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/config/rs6000/sysv4.h.diff?cvsroot=gcc&r1=1.150&r2=1.151
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/config/rs6000/rs6000.c.diff?cvsroot=gcc&r1=1.698&r2=1.699
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/config/rs6000/rs6000.h.diff?cvsroot=gcc&r1=1.337&r2=1.338



-- 


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


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

* [Bug target/17052] [3.5 Regression] altivec varargs failure if no optimization
  2004-08-16 20:10 [Bug middle-end/17052] New: altivec varargs failure if no optimization janis187 at us dot ibm dot com
                   ` (6 preceding siblings ...)
  2004-08-25  3:40 ` cvs-commit at gcc dot gnu dot org
@ 2004-08-25  3:46 ` amodra at bigpond dot net dot au
  7 siblings, 0 replies; 9+ messages in thread
From: amodra at bigpond dot net dot au @ 2004-08-25  3:46 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From amodra at bigpond dot net dot au  2004-08-25 03:46 -------
boo

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


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


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

end of thread, other threads:[~2004-08-25  3:46 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-08-16 20:10 [Bug middle-end/17052] New: altivec varargs failure if no optimization janis187 at us dot ibm dot com
2004-08-16 20:11 ` [Bug middle-end/17052] " janis187 at us dot ibm dot com
2004-08-16 20:52 ` [Bug middle-end/17052] [3.5 Regression] " pinskia at gcc dot gnu dot org
2004-08-16 21:08 ` janis187 at us dot ibm dot com
2004-08-23  7:58 ` amodra at bigpond dot net dot au
2004-08-23  8:47 ` amodra at bigpond dot net dot au
2004-08-24 14:38 ` [Bug target/17052] " amodra at bigpond dot net dot au
2004-08-25  3:40 ` cvs-commit at gcc dot gnu dot org
2004-08-25  3:46 ` amodra at bigpond dot net dot au

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).