re PR rtl-optimization/8613 (-O2 optimization generates wrong code)

PR optimization/8613
	* builtins.c (expand_builtin): Emit postincrements before expanding
	builtin functions.

From-SVN: r63207
This commit is contained in:
Glen Nakamura 2003-02-21 08:07:25 +00:00 committed by Eric Botcazou
parent e9019af616
commit 9e7d0b92a9
4 changed files with 30 additions and 0 deletions

View File

@ -1,3 +1,9 @@
2003-02-21 Glen Nakamura <glen@imodulo.com>
PR optimization/8613
* builtins.c (expand_builtin): Emit postincrements before expanding
builtin functions.
2003-02-21 Ben Elliston <bje@redhat.com>
PR other/5634

View File

@ -4012,6 +4012,9 @@ expand_builtin (exp, target, subtarget, mode, ignore)
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);

View File

@ -1,3 +1,7 @@
2003-02-21 Glen Nakamura <glen@imodulo.com>
* gcc.c-torture/execute/20030221-1.c: New test.
2003-02-20 Mark Mitchell <mark@codesourcery.com>
PR c++/9729

View File

@ -0,0 +1,17 @@
/* PR optimization/8613 */
/* Contributed by Glen Nakamura */
extern void abort (void);
int main (void)
{
char buf[16] = "1234567890";
char *p = buf;
*p++ = (char) __builtin_strlen (buf);
if ((buf[0] != 10) || (p - buf != 1))
abort ();
return 0;
}