From mboxrd@z Thu Jan 1 00:00:00 1970 From: hjl@lucon.org (H.J. Lu) To: wilson@cygnus.com (Jim Wilson) Cc: egcs@cygnus.com, scox@cygnus.com Subject: Re: A bug in mark_constants () in varasm.c Date: Tue, 17 Mar 1998 08:42:00 -0000 Message-id: References: <199803170341.TAA15214@rtl.cygnus.com> X-SW-Source: 1998-03/msg00574.html > > In order to reproduce this problem, I have to install your earlier i386.md > patch to handle CONST_DOUBLE in the mov*cc patterns. > > The problem here isn't a bug in varasm.c, it is a bug in your i386.md patch. > You have this: > default: > operands[3] = XEXP (operands[3], 0); > output_asm_insn (AS1 (fld%z3,%y3), operands); > where operands[3] is a CONST_DOUBLE. You are trying to fix an invalid > CONST_DOUBLE by loading it from CONST_DOUBLE_MEM, but that is wrong. > CONST_DOUBLE_MEM is an internal field for use by the compiler; it is > not valid for a md file to use it like this. It is not a MEM > equivalent to the constant as you seem to think it is. That is not my patch. I only optimized it for standard x87 constants. I didn't change anything else. > > If a CONST_DOUBLE is invalid here, then the correct way to fix it is to > change the predicates and/or constraints to indicate that a CONST_DOUBLE > is not valid here. That will cause reload to replace the CONST_DOUBLE with > a MEM, and that MEM will be valid (unlike CONST_DOUBLE_MEM). > > I'd suggest something like the following patch. This generates RTL that > looks OK but it fails in reg-stack.c. Offhand, I don't know why. > Thanks for looking into it. I'd like to hear comments from Stan first. Here is my complete patch to fix all the bugs in my 5 test cases. There are several bugs exposed in my 5 test cases: 1. FP constants in nested functions are broken on PPro. Even if you may compile the code, gcc will leave out the FP constant definitions such that there are undefined references to the FP constants. Use "nm" to see it. 2. reg-stack.c mishandles the conditional move. I will forard my analysis to you. BTW, I know my patch doesn't fix all the bugs. Jim, as you have observed that an invalid CONST_DOUBLE may still be used. Lucky for x86, only CONST0_RTX and CONST1_RTX are generated by gcc, which happen to be standard x87 constants. Thanks. H.J. ----