[Bug other/61300] powerpc64le miscompile with K&R-style function definition at -O0
rguenth at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Wed May 28 11:25:00 GMT 2014
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61300
--- Comment #3 from Richard Biener <rguenth at gcc dot gnu.org> ---
(In reply to Alan Modra from comment #1)
> So, the "writes way past this" is writing into the parameter save area.
>
> compare_kr is assuming that it was called with a parameter save area because
> it isn't prototyped, but that is quite wrong because when compiling the
> function body we don't know how the function was called. A call may well
> have a prototype in scope, and thus not set up a parameter save area.
>
> It's a bug in rs6000_function_parms_need_stack. This function can't blindly
> test !prototype_p (fun).
So you can simply drop that check instead as it seems to be an optimization
only? Thus
Index: gcc/config/rs6000/rs6000.c
===================================================================
--- gcc/config/rs6000/rs6000.c (revision 211011)
+++ gcc/config/rs6000/rs6000.c (working copy)
@@ -10492,7 +10492,7 @@ rs6000_function_parms_need_stack (tree f
fun = TREE_TYPE (fun);
/* Varargs functions need the parameter save area. */
- if (!prototype_p (fun) || stdarg_p (fun))
+ if (stdarg_p (fun))
return true;
INIT_CUMULATIVE_INCOMING_ARGS (args_so_far_v, fun, NULL_RTX);
?
More information about the Gcc-bugs
mailing list