Skip to content

Commit

Permalink
i386: Fix assert in ix86_function_arg [PR105970]
Browse files Browse the repository at this point in the history
The mode of pointer argument should equal ptr_mode, not Pmode.

2022-06-17  Uroš Bizjak  <ubizjak@gmail.com>

gcc/ChangeLog:

	PR target/105970
	* config/i386/i386.cc (ix86_function_arg): Assert that
	the mode of pointer argumet is equal to ptr_mode, not Pmode.

gcc/testsuite/ChangeLog:

	PR target/105970
	* gcc.target/i386/pr105970.c: New test.
  • Loading branch information
ubizjak committed Jun 17, 2022
1 parent 1d6044c commit 1f8278b
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
2 changes: 1 addition & 1 deletion gcc/config/i386/i386.cc
Original file line number Diff line number Diff line change
Expand Up @@ -3348,7 +3348,7 @@ ix86_function_arg (cumulative_args_t cum_v, const function_arg_info &arg)
if (POINTER_TYPE_P (arg.type))
{
/* This is the pointer argument. */
gcc_assert (TYPE_MODE (arg.type) == Pmode);
gcc_assert (TYPE_MODE (arg.type) == ptr_mode);
/* It is at -WORD(AP) in the current frame in interrupt and
exception handlers. */
reg = plus_constant (Pmode, arg_pointer_rtx, -UNITS_PER_WORD);
Expand Down
6 changes: 6 additions & 0 deletions gcc/testsuite/gcc.target/i386/pr105970.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
/* PR target/105970 */
/* { dg-do compile { target { ! ia32 } } } */
/* { dg-require-effective-target maybe_x32 } */
/* { dg-options "-mx32 -mgeneral-regs-only -maddress-mode=long" } */

#include "../../gcc.dg/torture/pr68037-1.c"

0 comments on commit 1f8278b

Please sign in to comment.