This is the mail archive of the mailing list for the GCC project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Fix compile/20030224-1.c

On Tue, Feb 25, 2003 at 06:11:41PM -0700, law at redhat dot com wrote:
>  >Look at the .00.rtl dump -- eax is marked used, but
>  >never initialized.
> I didn't say it wasn't odd :-)  I've got no clue why we're considering
> %eax an argument register in this case.  Someone with more intimate
> knowledge of the x86 port would probably need to delve into that.

Found it.

  int bytes =
    (mode == BLKmode) ? int_size_in_bytes (type) : (int) GET_MODE_SIZE (mode);

	Since type is variable sized, int_size_in_bytes returns -1.

  int words = (bytes + UNITS_PER_WORD - 1) / UNITS_PER_WORD;

	(-1 + 4 - 1) / 4 == 0.  Oops.

  if (words <= cum->nregs)

	Which is always true, which leads us to belive that
	we're going to pass the variable sized struct in eax.
	Of course, this doesn't match up with what we decide
	in MUST_PASS_IN_STACK, so that's not where the data
	actually gets put.

Fixed thus.

Also, I think it's bad form that your test case declares a
return type of int, but doesn't return anything.  It shouldn't
have affected the reproducibility of this bug as all, so I
suggest changing it.


	* config/i386/i386.c (function_arg): Pass variable sized
	structures correctly on the stack.

Index: config/i386/i386.c
RCS file: /cvs/gcc/gcc/gcc/config/i386/i386.c,v
retrieving revision 1.542
diff -c -p -d -r1.542 i386.c
*** config/i386/i386.c	25 Feb 2003 11:39:19 -0000	1.542
--- config/i386/i386.c	26 Feb 2003 01:14:49 -0000
*************** function_arg (cum, mode, type, named)
*** 2468,2473 ****
--- 2468,2476 ----
        case BLKmode:
+ 	if (bytes < 0)
+ 	  break;
+ 	/* FALLTHRU */
        case DImode:
        case SImode:
        case HImode:

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]