public inbox for gcc-prs@sourceware.org
help / color / mirror / Atom feed
* optimization/9226: GCSE breaking argument passing
@ 2003-01-08 14:26 schwab
  0 siblings, 0 replies; 2+ messages in thread
From: schwab @ 2003-01-08 14:26 UTC (permalink / raw)
  To: gcc-gnats


>Number:         9226
>Category:       optimization
>Synopsis:       GCSE breaking argument passing
>Confidential:   no
>Severity:       critical
>Priority:       medium
>Responsible:    unassigned
>State:          open
>Class:          wrong-code
>Submitter-Id:   net
>Arrival-Date:   Wed Jan 08 06:26:01 PST 2003
>Closed-Date:
>Last-Modified:
>Originator:     
>Release:        3.4 20030107 (experimental)
>Organization:
>Environment:
System: Linux sykes 2.4.19-SMP #1 SMP Wed Dec 11 22:55:37 UTC 2002 ia64 unknown unknown GNU/Linux
Architecture: ia64

	
host: ia64-unknown-linux-gnu
build: ia64-unknown-linux-gnu
target: m68k-unknown-linux-gnu
configured with: /cvs/gcc/configure --with-gcc-version-trigger=/cvs/gcc/gcc/version.c --host=ia64-unknown-linux --target=m68k-linux --prefix=/usr/local/m68k-linux --enable-languages=c++ --with-ld=/usr/local/m68k-linux/m68k-linux/bin/ld --with-as=/usr/local/m68k-linux/m68k-linux/bin/as --enable-shared 
>Description:
GCSE is replacing references to the stack pointer by a different register
during argument passing.

Before GCSE:

(insn 24 23 28 0 0x2000000002410840 (set (reg/v/f:SI 36)
        (reg/f:SI 15 %sp)) 29 {*m68k.md:978} (nil)
    (nil))

(insn 28 24 29 0 0x2000000002410840 (set (mem/f:SI (pre_dec:SI (reg/f:SI 15 %sp)) [0 S4 A16])
        (reg/v:SI 33)) 29 {*m68k.md:978} (nil)
    (nil))

(insn 29 28 30 0 0x2000000002410840 (set (mem/f:SI (pre_dec:SI (reg/f:SI 15 %sp)) [0 S4 A16])
        (reg/v/f:SI 29)) 29 {*m68k.md:978} (nil)
    (nil))

(insn 30 29 31 0 0x2000000002410840 (set (mem/f:SI (pre_dec:SI (reg/f:SI 15 %sp)) [0 S4 A16])
        (reg/v/f:SI 36)) 29 {*m68k.md:978} (nil)
    (nil))

(insn 31 30 32 0 0x2000000002410840 (set (reg/f:SI 44)
        (symbol_ref:SI ("memcpy"))) 29 {*m68k.md:978} (nil)
    (expr_list:REG_EQUAL (symbol_ref:SI ("memcpy"))
        (nil)))

After GCSE:

(insn 24 23 28 0 0x2000000002410840 (set (reg/v/f:SI 36)
        (reg/f:SI 15 %sp)) 29 {*m68k.md:978} (nil)
    (nil))

(insn 28 24 29 0 0x2000000002410840 (set (mem/f:SI (pre_dec:SI (reg/f:SI 15 %sp)) [0 S4 A16])
        (reg/v:SI 33)) 29 {*m68k.md:978} (nil)
    (nil))

(insn 29 28 30 0 0x2000000002410840 (set (mem/f:SI (pre_dec:SI (reg/v/f:SI 36)) [0 S4 A16])
        (reg/v/f:SI 29)) 29 {*m68k.md:978} (nil)
    (nil))

(insn 30 29 31 0 0x2000000002410840 (set (mem/f:SI (pre_dec:SI (reg/v/f:SI 36)) [0 S4 A16])
        (reg/v/f:SI 36)) 29 {*m68k.md:978} (nil)
    (nil))

(insn 31 30 32 0 0x2000000002410840 (set (reg/f:SI 44)
        (symbol_ref:SI ("memcpy"))) 29 {*m68k.md:978} (nil)
    (expr_list:REG_EQUAL (symbol_ref:SI ("memcpy"))
        (nil)))

(reg 36) is not a valid replacement for (reg 15).
>How-To-Repeat:
$ cat alloca.c
typedef unsigned int size_t;
void *memcpy (void *__restrict, const void *__restrict, size_t);
size_t strlen (const char *);
int printf (const char *, ...);
# define strdupa(s)							      \
  (__extension__							      \
    ({									      \
      __const char *__old = (s);					      \
      size_t __len = strlen (__old) + 1;				      \
      char *__new = (char *) __builtin_alloca (__len);			      \
      (char *) memcpy (__new, __old, __len);				      \
    }))

void
foo (const char *x)
{
  size_t nx;
  char *y = strdupa (x);
  nx = 1;
  while (*y)
    {
      if (*y == ':' || *y == ';')
	++nx;
      y++;
    }
  printf ("%s %zu", y, nx);
}
$ m68k-linux-gcc -S -O2 alloca.c
>Fix:
	
>Release-Note:
>Audit-Trail:
>Unformatted:


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

* Re: optimization/9226: GCSE breaking argument passing
@ 2003-02-07 23:03 rth
  0 siblings, 0 replies; 2+ messages in thread
From: rth @ 2003-02-07 23:03 UTC (permalink / raw)
  To: gcc-bugs, gcc-prs, nobody, rth, schwab

Synopsis: GCSE breaking argument passing

Responsible-Changed-From-To: unassigned->rth
Responsible-Changed-By: rth
Responsible-Changed-When: Fri Feb  7 23:03:04 2003
Responsible-Changed-Why:
    .
State-Changed-From-To: open->closed
State-Changed-By: rth
State-Changed-When: Fri Feb  7 23:03:04 2003
State-Changed-Why:
    http://gcc.gnu.org/ml/gcc-patches/2003-02/msg00373.html

http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&database=gcc&pr=9226


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

end of thread, other threads:[~2003-02-07 23:03 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-01-08 14:26 optimization/9226: GCSE breaking argument passing schwab
2003-02-07 23:03 rth

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