Commit 9e7d0b92 by Glen Nakamura Committed by Eric Botcazou

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
parent e9019af6
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> 2003-02-21 Ben Elliston <bje@redhat.com>
PR other/5634 PR other/5634
......
...@@ -4012,6 +4012,9 @@ expand_builtin (exp, target, subtarget, mode, ignore) ...@@ -4012,6 +4012,9 @@ expand_builtin (exp, target, subtarget, mode, ignore)
tree arglist = TREE_OPERAND (exp, 1); tree arglist = TREE_OPERAND (exp, 1);
enum built_in_function fcode = DECL_FUNCTION_CODE (fndecl); 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) if (DECL_BUILT_IN_CLASS (fndecl) == BUILT_IN_MD)
return (*targetm.expand_builtin) (exp, target, subtarget, mode, ignore); return (*targetm.expand_builtin) (exp, target, subtarget, mode, ignore);
......
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> 2003-02-20 Mark Mitchell <mark@codesourcery.com>
PR c++/9729 PR c++/9729
......
/* 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;
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment