Commit 6a4e56a9 by Jakub Jelinek Committed by Jakub Jelinek

re PR middle-end/32285 (Miscompilation with pure _Complex returning call inside…

re PR middle-end/32285 (Miscompilation with pure _Complex returning call inside another fn's argument list)

	PR middle-end/32285
	* calls.c (precompute_arguments): Also precompute CALL_EXPR arguments
	if ACCUMULATE_OUTGOING_ARGS.

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

From-SVN: r125873
parent 6cb62483
2007-06-20 Jakub Jelinek <jakub@redhat.com>
PR middle-end/32285
* calls.c (precompute_arguments): Also precompute CALL_EXPR arguments
if ACCUMULATE_OUTGOING_ARGS.
2007-06-19 Rask Ingemann Lambertsen <rask@sygehus.dk> 2007-06-19 Rask Ingemann Lambertsen <rask@sygehus.dk>
* config/m68hc11/m68hc11.c: Include dataflow header file. * config/m68hc11/m68hc11.c: Include dataflow header file.
......
...@@ -1269,13 +1269,25 @@ precompute_arguments (int flags, int num_actuals, struct arg_data *args) ...@@ -1269,13 +1269,25 @@ precompute_arguments (int flags, int num_actuals, struct arg_data *args)
/* If this is a libcall, then precompute all arguments so that we do not /* If this is a libcall, then precompute all arguments so that we do not
get extraneous instructions emitted as part of the libcall sequence. */ get extraneous instructions emitted as part of the libcall sequence. */
if ((flags & ECF_LIBCALL_BLOCK) == 0)
/* If we preallocated the stack space, and some arguments must be passed
on the stack, then we must precompute any parameter which contains a
function call which will store arguments on the stack.
Otherwise, evaluating the parameter may clobber previous parameters
which have already been stored into the stack. (we have code to avoid
such case by saving the outgoing stack arguments, but it results in
worse code) */
if ((flags & ECF_LIBCALL_BLOCK) == 0 && !ACCUMULATE_OUTGOING_ARGS)
return; return;
for (i = 0; i < num_actuals; i++) for (i = 0; i < num_actuals; i++)
{ {
enum machine_mode mode; enum machine_mode mode;
if ((flags & ECF_LIBCALL_BLOCK) == 0
&& TREE_CODE (args[i].tree_value) != CALL_EXPR)
continue;
/* If this is an addressable type, we cannot pre-evaluate it. */ /* If this is an addressable type, we cannot pre-evaluate it. */
gcc_assert (!TREE_ADDRESSABLE (TREE_TYPE (args[i].tree_value))); gcc_assert (!TREE_ADDRESSABLE (TREE_TYPE (args[i].tree_value)));
......
2007-06-20 Jakub Jelinek <jakub@redhat.com>
PR middle-end/32285
* gcc.c-torture/execute/20070614-1.c: New test.
2007-06-19 Seongbae Park <seongbae.park@gmail.com> 2007-06-19 Seongbae Park <seongbae.park@gmail.com>
* gcc.target/arm/stack-corruption.c: New test. * gcc.target/arm/stack-corruption.c: New test.
extern void abort (void);
_Complex v = 3.0 + 1.0iF;
void
foo (_Complex z, int *x)
{
if (z != v)
abort ();
}
_Complex bar (_Complex z) __attribute__ ((pure));
_Complex
bar (_Complex z)
{
return v;
}
int
baz (void)
{
int a, i;
for (i = 0; i < 6; i++)
foo (bar (1.0iF * i), &a);
return 0;
}
int
main ()
{
baz ();
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