Commit 29bfcb6d by Jakub Jelinek Committed by Jakub Jelinek

re PR middle-end/18951 (Invalid code generated by expand_errno_check)

	PR middle-end/18951
	* builtins.c (expand_builtin_mathfn, expand_builtin_mathfn_2,
	expand_builtin_mathfn_3): Avoid using arguments passed to
	save_expr after that call.

	* gcc.c-torture/execute/20041213-1.c: New test.

From-SVN: r92151
parent 2a1a3cd5
2004-12-14 Jakub Jelinek <jakub@redhat.com>
PR middle-end/18951
* builtins.c (expand_builtin_mathfn, expand_builtin_mathfn_2,
expand_builtin_mathfn_3): Avoid using arguments passed to
save_expr after that call.
* fold-const.c (fold_single_bit_test): If flag_syntax_only, pretend
LOAD_EXTEND_OP is not defined.
(fold): Likewise. If flag_syntax_only, don't depend on BITS_PER_WORD.
......
......@@ -1771,6 +1771,7 @@ expand_builtin_mathfn (tree exp, rtx target, rtx subtarget)
narg = builtin_save_expr (arg);
if (narg != arg)
{
arg = narg;
arglist = build_tree_list (NULL_TREE, arg);
exp = build_function_call_expr (fndecl, arglist);
}
......@@ -1910,6 +1911,7 @@ expand_builtin_mathfn_2 (tree exp, rtx target, rtx subtarget)
narg = builtin_save_expr (arg1);
if (narg != arg1)
{
arg1 = narg;
temp = build_tree_list (NULL_TREE, narg);
stable = false;
}
......@@ -1919,6 +1921,7 @@ expand_builtin_mathfn_2 (tree exp, rtx target, rtx subtarget)
narg = builtin_save_expr (arg0);
if (narg != arg0)
{
arg0 = narg;
arglist = tree_cons (NULL_TREE, narg, temp);
stable = false;
}
......@@ -2029,6 +2032,7 @@ expand_builtin_mathfn_3 (tree exp, rtx target, rtx subtarget)
narg = save_expr (arg);
if (narg != arg)
{
arg = narg;
arglist = build_tree_list (NULL_TREE, arg);
exp = build_function_call_expr (fndecl, arglist);
}
......
2004-12-14 Jakub Jelinek <jakub@redhat.com>
PR middle-end/18951
* gcc.c-torture/execute/20041213-1.c: New test.
2004-12-14 Nathan Sidwell <nathan@codesourcery.com>
PR c++/18949
......
extern double sqrt (double);
extern void abort (void);
int once;
double foo (void)
{
if (once++)
abort ();
return 0.0 / 0.0;
}
double x;
int main (void)
{
x = sqrt (foo ());
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