public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug target/18896] New: addressing split complex parm
@ 2004-12-09  1:45 amodra at bigpond dot net dot au
  2004-12-09  1:48 ` [Bug target/18896] " amodra at bigpond dot net dot au
                   ` (6 more replies)
  0 siblings, 7 replies; 8+ messages in thread
From: amodra at bigpond dot net dot au @ 2004-12-09  1:45 UTC (permalink / raw)
  To: gcc-bugs

On powerpc64-linux, with this testcase

int f (_Complex double a)
{
  extern _Complex double cd;
  return memcmp (&a, &cd, sizeof (a));
}

I'm hitting this assert in expand_expr_addr_expr_1

	  /* If the DECL isn't in memory, then the DECL wasn't properly
	     marked TREE_ADDRESSABLE, which will be either a front-end
	     or a tree optimizer bug.  */
	  gcc_assert (GET_CODE (result) == MEM);

The decl rtl is:

(concat:DC (mem/i:DF (reg/f:DI 113 virtual-incoming-args) [0 a+0 S8 A64])
    (reg/v:DF 119 [ a+8 ]))

That's buggy.  We shouldn't have part of the concat in memory, and part
in a reg.  Fixed with:

	* function.c (split_complex_args): Copy TREE_ADDRESSABLE for
	synthetic decl.

With that, we get 

(concat:DC (mem/i:DF (reg/f:DI 113 virtual-incoming-args) [0 a+0 S8 A64])
    (mem/i:DF (plus:DI (reg/f:DI 113 virtual-incoming-args)
            (const_int 8 [0x8])) [0 D.1119+0 S8 A64]))

Now I'm not sure where this should be fixed.  I'm guessing that the hack
I have in my local tree in expand_expr_addr_expr_1 to look inside the
CONCAT isn't the right place to fix this.  Also there's a much worse
problem;  The two pieces of the concat might not be adjacent.  Consider

int g (_Complex float a)
{
  extern _Complex float cf;
  return memcmp (&a, &cf, sizeof (a));
}

For this, the decl rtl is now

(concat:SC (mem/i:SF (reg/f:DI 113 virtual-incoming-args) [0 a+0 S4 A64])
    (mem/i:SF (plus:DI (reg/f:DI 113 virtual-incoming-args)
            (const_int 8 [0x8])) [0 D.1128+0 S4 A64]))

Notice that the two mems are 8 bytes apart but a _Complex float in
memory should have the two 4 byte parts adjacent.


Index: gcc/function.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/function.c,v
retrieving revision 1.592
diff -u -p -r1.592 function.c
--- gcc/function.c	1 Dec 2004 18:13:30 -0000	1.592
+++ gcc/function.c	9 Dec 2004 00:48:12 -0000
@@ -2061,6 +2061,7 @@ split_complex_args (tree args)
 	  /* Build a second synthetic decl.  */
 	  decl = build_decl (PARM_DECL, NULL_TREE, subtype);
 	  DECL_ARG_TYPE (decl) = DECL_ARG_TYPE (p);
+	  TREE_ADDRESSABLE (decl) = TREE_ADDRESSABLE (p);
 	  layout_decl (decl, 0);
 
 	  /* Splice it in; skip the new decl.  */

-- 
           Summary: addressing split complex parm
           Product: gcc
           Version: 4.0.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: target
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: amodra at bigpond dot net dot au
                CC: gcc-bugs at gcc dot gnu dot org
GCC target triplet: powerpc64-linux


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


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

* [Bug target/18896] addressing split complex parm
  2004-12-09  1:45 [Bug target/18896] New: addressing split complex parm amodra at bigpond dot net dot au
@ 2004-12-09  1:48 ` amodra at bigpond dot net dot au
  2004-12-09  5:51 ` amodra at bigpond dot net dot au
                   ` (5 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: amodra at bigpond dot net dot au @ 2004-12-09  1:48 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From amodra at bigpond dot net dot au  2004-12-09 01:48 -------
Created an attachment (id=7709)
 --> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=7709&action=view)
testcase


-- 


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


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

* [Bug target/18896] addressing split complex parm
  2004-12-09  1:45 [Bug target/18896] New: addressing split complex parm amodra at bigpond dot net dot au
  2004-12-09  1:48 ` [Bug target/18896] " amodra at bigpond dot net dot au
@ 2004-12-09  5:51 ` amodra at bigpond dot net dot au
  2004-12-09  6:58 ` rth at gcc dot gnu dot org
                   ` (4 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: amodra at bigpond dot net dot au @ 2004-12-09  5:51 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From amodra at bigpond dot net dot au  2004-12-09 05:51 -------
Fixing assign_parms_unsplit_complex

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
         AssignedTo|unassigned at gcc dot gnu   |amodra at bigpond dot net
                   |dot org                     |dot au
             Status|UNCONFIRMED                 |ASSIGNED


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


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

* [Bug target/18896] addressing split complex parm
  2004-12-09  1:45 [Bug target/18896] New: addressing split complex parm amodra at bigpond dot net dot au
  2004-12-09  1:48 ` [Bug target/18896] " amodra at bigpond dot net dot au
  2004-12-09  5:51 ` amodra at bigpond dot net dot au
@ 2004-12-09  6:58 ` rth at gcc dot gnu dot org
  2004-12-10 14:15 ` amodra at bigpond dot net dot au
                   ` (3 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: rth at gcc dot gnu dot org @ 2004-12-09  6:58 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From rth at gcc dot gnu dot org  2004-12-09 06:58 -------
I think the correct solution is to explicitly *clear* TREE_ADDRESSABLE in
split_complex_args and set DECL_ARTIFICIAL so that the two pieces get 
allocated to pseudo registers.  Then unsplit_complex needs to notice that
the original decl is TREE_ADDRESSABLE, allocate contiguous memory, and store
the two pseudos into it.

Something to work on for 4.1 might be noticing that the two members of the
concat live in adjacent parameter memory, and promote that parameter memory
to the address of the entire complex.  That wouldn't be particularly easy 
at the stage that unsplit_complex is currently called.

-- 


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


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

* [Bug target/18896] addressing split complex parm
  2004-12-09  1:45 [Bug target/18896] New: addressing split complex parm amodra at bigpond dot net dot au
                   ` (2 preceding siblings ...)
  2004-12-09  6:58 ` rth at gcc dot gnu dot org
@ 2004-12-10 14:15 ` amodra at bigpond dot net dot au
  2004-12-23  0:11 ` cvs-commit at gcc dot gnu dot org
                   ` (2 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: amodra at bigpond dot net dot au @ 2004-12-10 14:15 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From amodra at bigpond dot net dot au  2004-12-10 14:14 -------
http://gcc.gnu.org/ml/gcc-patches/2004-12/msg00682.html

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |ABI, ice-on-valid-code,
                   |                            |patch, wrong-code


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


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

* [Bug target/18896] addressing split complex parm
  2004-12-09  1:45 [Bug target/18896] New: addressing split complex parm amodra at bigpond dot net dot au
                   ` (3 preceding siblings ...)
  2004-12-10 14:15 ` amodra at bigpond dot net dot au
@ 2004-12-23  0:11 ` cvs-commit at gcc dot gnu dot org
  2004-12-23  0:33 ` amodra at bigpond dot net dot au
  2004-12-23  0:40 ` pinskia at gcc dot gnu dot org
  6 siblings, 0 replies; 8+ messages in thread
From: cvs-commit at gcc dot gnu dot org @ 2004-12-23  0:11 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From cvs-commit at gcc dot gnu dot org  2004-12-23 00:11 -------
Subject: Bug 18896

CVSROOT:	/cvs/gcc
Module name:	gcc
Changes by:	amodra@gcc.gnu.org	2004-12-23 00:10:50

Modified files:
	gcc            : ChangeLog function.c 

Log message:
	PR target/18896
	* function.c (split_complex_args): Set DECL_ARTIFICIAL and DECL_IGNORED_P
	for real and imaginary parts if the parm is addressable.
	(assign_parms_unsplit_complex): If parm addressable, save real
	and imaginary parts to a stack temp.  Pass assign_parm_data_all.
	(assign_parms): Adjust assign_parms_unsplit_complex call.

Patches:
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/ChangeLog.diff?cvsroot=gcc&r1=2.6924&r2=2.6925
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/function.c.diff?cvsroot=gcc&r1=1.595&r2=1.596



-- 


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


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

* [Bug target/18896] addressing split complex parm
  2004-12-09  1:45 [Bug target/18896] New: addressing split complex parm amodra at bigpond dot net dot au
                   ` (4 preceding siblings ...)
  2004-12-23  0:11 ` cvs-commit at gcc dot gnu dot org
@ 2004-12-23  0:33 ` amodra at bigpond dot net dot au
  2004-12-23  0:40 ` pinskia at gcc dot gnu dot org
  6 siblings, 0 replies; 8+ messages in thread
From: amodra at bigpond dot net dot au @ 2004-12-23  0:33 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From amodra at bigpond dot net dot au  2004-12-23 00:33 -------
Fixed mainline.  gcc-3.4 not affected by this particular problem.

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


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


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

* [Bug target/18896] addressing split complex parm
  2004-12-09  1:45 [Bug target/18896] New: addressing split complex parm amodra at bigpond dot net dot au
                   ` (5 preceding siblings ...)
  2004-12-23  0:33 ` amodra at bigpond dot net dot au
@ 2004-12-23  0:40 ` pinskia at gcc dot gnu dot org
  6 siblings, 0 replies; 8+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-12-23  0:40 UTC (permalink / raw)
  To: gcc-bugs



-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|---                         |4.0.0


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


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

end of thread, other threads:[~2004-12-23  0:40 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-12-09  1:45 [Bug target/18896] New: addressing split complex parm amodra at bigpond dot net dot au
2004-12-09  1:48 ` [Bug target/18896] " amodra at bigpond dot net dot au
2004-12-09  5:51 ` amodra at bigpond dot net dot au
2004-12-09  6:58 ` rth at gcc dot gnu dot org
2004-12-10 14:15 ` amodra at bigpond dot net dot au
2004-12-23  0:11 ` cvs-commit at gcc dot gnu dot org
2004-12-23  0:33 ` amodra at bigpond dot net dot au
2004-12-23  0:40 ` pinskia at gcc dot gnu dot org

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