public inbox for gcc-prs@sourceware.org
help / color / mirror / Atom feed
* Re: optimization/8613: [3.2/3.3/3.4 regression] -O2 optimization generates wrong code
@ 2003-02-20 20:06 Eric Botcazou
  0 siblings, 0 replies; 5+ messages in thread
From: Eric Botcazou @ 2003-02-20 20:06 UTC (permalink / raw)
  To: nobody; +Cc: gcc-prs

The following reply was made to PR optimization/8613; it has been noted by GNATS.

From: Eric Botcazou <ebotcazou@libertysurf.fr>
To: Glen Nakamura <glen@imodulo.com>
Cc: gcc-gnats@gcc.gnu.org,
 gcc-bugs@gcc.gnu.org
Subject: Re: optimization/8613: [3.2/3.3/3.4 regression] -O2 optimization generates wrong code
Date: Thu, 20 Feb 2003 20:56:39 +0100

 > Someone with write access should checkin this patch:
 > http://gcc.gnu.org/ml/gcc-patches/2003-02/msg01531.html
 
 I'll do.
 
 > FYI, I've only regtested this patch on the 3.3 branch.
 
 I'm going to bootstrap/regtest it on the 3.2 branch and commit it there too
 if everything goes well.
 
 -- 
 Eric Botcazou


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

* Re: optimization/8613: [3.2/3.3/3.4 regression] -O2 optimization generates wrong code
@ 2003-02-21  8:34 ebotcazou
  0 siblings, 0 replies; 5+ messages in thread
From: ebotcazou @ 2003-02-21  8:34 UTC (permalink / raw)
  To: gcc-bugs, gcc-prs, mark.odonohue, nobody

Synopsis: [3.2/3.3/3.4 regression] -O2 optimization generates wrong code

State-Changed-From-To: analyzed->closed
State-Changed-By: ebotcazou
State-Changed-When: Fri Feb 21 08:34:56 2003
State-Changed-Why:
    Fixed.

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


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

* Re: optimization/8613: [3.2/3.3/3.4 regression] -O2 optimization generates wrong code
@ 2003-02-20 19:46 Glen Nakamura
  0 siblings, 0 replies; 5+ messages in thread
From: Glen Nakamura @ 2003-02-20 19:46 UTC (permalink / raw)
  To: nobody; +Cc: gcc-prs

The following reply was made to PR optimization/8613; it has been noted by GNATS.

From: Glen Nakamura <glen@imodulo.com>
To: gcc-gnats@gcc.gnu.org, gcc-bugs@gcc.gnu.org
Cc:  
Subject: Re: optimization/8613: [3.2/3.3/3.4 regression] -O2 optimization generates wrong code
Date: Thu, 20 Feb 2003 09:39:43 -1000

 http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&database=gcc&pr=8613
 
 Someone with write access should checkin this patch:
 http://gcc.gnu.org/ml/gcc-patches/2003-02/msg01531.html
 
 Patch approval is here:
 http://gcc.gnu.org/ml/gcc-patches/2003-02/msg01578.html
 
 FYI, I've only regtested this patch on the 3.3 branch.
 


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

* Re: optimization/8613: [3.2/3.3/3.4 regression] -O2 optimization generates wrong code
@ 2003-02-19  9:16 Glen Nakamura
  0 siblings, 0 replies; 5+ messages in thread
From: Glen Nakamura @ 2003-02-19  9:16 UTC (permalink / raw)
  To: nobody; +Cc: gcc-prs

The following reply was made to PR optimization/8613; it has been noted by GNATS.

From: Glen Nakamura <glen@imodulo.com>
To: gcc-gnats@gcc.gnu.org, gcc-bugs@gcc.gnu.org,
	mark.odonohue@cytopia.com.au
Cc:  
Subject: Re: optimization/8613: [3.2/3.3/3.4 regression] -O2 optimization generates wrong code
Date: Tue, 18 Feb 2003 23:10:09 -1000

 http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&database=gcc&pr=8613
 
 I've tracked this bug down to a problem with postincrements and the strlen
 builtin function.  What happens is that the postincrement code isn't emitted
 before the builtin strlen function is expanded and gets emitted within the
 loop created by ix86_expand_strlensi_unroll_1.  This causes the postincrement
 code to be executed multiple times when calculating the string length.
 The fix is to call emit_queue before expanding the strlen builtin so the
 postincrement code is emitted outside of the loop.
 
 I'm not exactly sure where the emit_queue call should be placed.  Although
 adding emit_queue to expand_builtin_strlen would work, I added it to
 expand_builtin instead, because other builtins may have the same problem.
 It passed regression testing on i686-pc-linux-gnu for the 3.3 branch,
 but a more experienced developer should decide where the best place is.
 
 Here is a reduced testcase:
 
 extern void abort (void);
 
 int
 main ()
 {
   char buf[16] = "1234567890";
   char *p = buf;
   *p++ = (char) __builtin_strlen (buf);
   if ((buf[0] != 10) || (p - buf != 1))
     abort ();
 }
 
 And here is the patch:
 
 2003-02-19  Glen Nakamura  <glen@imodulo.com>
 
 	* builtins.c (expand_builtin): Emit postincrements before expanding
 	builtin functions.
 
 diff -Nru3p gcc-3.3.orig/gcc/builtins.c gcc-3.3/gcc/builtins.c
 --- gcc-3.3.orig/gcc/builtins.c	2002-12-01 17:51:43.000000000 +0000
 +++ gcc-3.3/gcc/builtins.c	2002-12-01 17:51:43.000000000 +0000
 @@ -3691,6 +3691,9 @@ expand_builtin (exp, target, subtarget, 
    tree arglist = TREE_OPERAND (exp, 1);
    enum built_in_function fcode = DECL_FUNCTION_CODE (fndecl);
  
 +  /* Perform postincrements before expanding builtin functions.  */
 +  emit_queue ();
 +
    if (DECL_BUILT_IN_CLASS (fndecl) == BUILT_IN_MD)
      return (*targetm.expand_builtin) (exp, target, subtarget, mode, ignore);
  


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

* Re: optimization/8613: [3.2/3.3/3.4 regression] -O2 optimization generates wrong code
@ 2003-02-18 14:35 ebotcazou
  0 siblings, 0 replies; 5+ messages in thread
From: ebotcazou @ 2003-02-18 14:35 UTC (permalink / raw)
  To: gcc-bugs, gcc-prs, mark.odonohue, nobody

Old Synopsis: -O3 optimisation of ++ generates wrong code
New Synopsis: [3.2/3.3/3.4 regression] -O2 optimization generates wrong code

State-Changed-From-To: open->analyzed
State-Changed-By: ebotcazou
State-Changed-When: Tue Feb 18 14:35:38 2003
State-Changed-Why:
    Confirmed on all versions since gcc 3.0: simply compile with -O2 -mcpu=[456]86. Simplified C testcase attached.

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


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

end of thread, other threads:[~2003-02-21  8:34 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-02-20 20:06 optimization/8613: [3.2/3.3/3.4 regression] -O2 optimization generates wrong code Eric Botcazou
  -- strict thread matches above, loose matches on Subject: below --
2003-02-21  8:34 ebotcazou
2003-02-20 19:46 Glen Nakamura
2003-02-19  9:16 Glen Nakamura
2003-02-18 14:35 ebotcazou

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