From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 5469 invoked by alias); 9 Sep 2004 15:29:06 -0000 Mailing-List: contact gcc-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Archive: List-Post: List-Help: Sender: gcc-owner@gcc.gnu.org Received: (qmail 5459 invoked from network); 9 Sep 2004 15:29:04 -0000 Received: from unknown (HELO atrey.karlin.mff.cuni.cz) (195.113.31.123) by sourceware.org with SMTP; 9 Sep 2004 15:29:04 -0000 Received: by atrey.karlin.mff.cuni.cz (Postfix, from userid 4018) id F25654B4356; Thu, 9 Sep 2004 17:29:03 +0200 (CEST) Date: Thu, 09 Sep 2004 17:24:00 -0000 From: Jan Hubicka To: Arnaud Charlet Cc: Nathan Sidwell , gcc@gcc.gnu.org, uros@kss-loka.si Subject: Re: Ada broken on i686-linux Message-ID: <20040909152903.GE325@atrey.karlin.mff.cuni.cz> References: <20040909122540.B18817@dublin.act-europe.fr> <41403255.8040701@codesourcery.com> <20040909124026.C18817@dublin.act-europe.fr> <20040909160504.A15482@dublin.act-europe.fr> <20040909165112.A23736@dublin.act-europe.fr> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20040909165112.A23736@dublin.act-europe.fr> User-Agent: Mutt/1.5.6i X-SW-Source: 2004-09/txt/msg00445.txt.bz2 > > This can be worked around compiling with -O0, so I'll try a bootstrap with > > everything built at -O0 to see whether I can get at least a successful build > > and commit my pending changes. > > Well, I am now hitting the crash already mentioned by Richard and Laurent > on x86_64: > > << > ../../xgcc -B../../ -c -g -O0 -fPIC -W -Wall -gnatpg a-ncelfu.ads -o a-ncelfu.o > +===========================GNAT BUG DETECTED==============================+ > | 3.5.0 20040909 (experimental) (i686-pc-linux-gnu) GCC error: | > | in optimize_mode_switching, at lcm.c:1225 | > | Error detected at a-ngelfu.adb:172:16 [a-ngcefu.adb:38:4 [a-ncelfu.ads:19:1]]|>> This should be fixed by this patch (this problem is also reproduced by i686 build). As discussed with Uros, the current implementation is not perfect as the mode switching generates unnecesary initializations of the varioius control words and then it generates too many loads of control word from them but still it is better than old implementation, so I would commit it before we get into the more proper sollution. I think we might get around the first problem by using separate entities for each mode we want, but still it will generate unnecesary loads of the global control word that might be avoided by tricking it to be special entity 0. The second problem might be solved either by XFmode spilling or post-reload optimize_mode_switching pass inserting the control word loads. Bot since it is somewhat involved, I've bootstrapped/regtested the attached patch i686-pc-gnu-linux, OK? double sqrt(double); template class arr { private: long s; T *d; public: arr() : s(0), d(0) {} ~arr() { delete[] d; } void alloc (long sz); const T &operator[] (long n) const {return d[n];} }; void blah () { arr index; index.alloc(10); for (int i=0; i<10; ++i) { int l = int(sqrt(index[0])); if (l<0) throw 2; } } Honza Index: config/i386/i386.h =================================================================== RCS file: /cvs/gcc/gcc/gcc/config/i386/i386.h,v retrieving revision 1.400 diff -c -3 -p -r1.400 i386.h *** config/i386/i386.h 4 Sep 2004 07:55:07 -0000 1.400 --- config/i386/i386.h 9 Sep 2004 08:18:02 -0000 *************** extern rtx ix86_compare_op1; /* operand *** 2966,2972 **** (GET_CODE (I) == CALL_INSN \ || (GET_CODE (I) == INSN && (asm_noperands (PATTERN (I)) >= 0 \ || GET_CODE (PATTERN (I)) == ASM_INPUT))\ ! ? I387_CW_ANY \ : recog_memoized (I) < 0 \ ? I387_CW_ANY \ : get_attr_i387_cw (I)) --- 2966,2972 ---- (GET_CODE (I) == CALL_INSN \ || (GET_CODE (I) == INSN && (asm_noperands (PATTERN (I)) >= 0 \ || GET_CODE (PATTERN (I)) == ASM_INPUT))\ ! ? I387_CW_UNINITIALIZED \ : recog_memoized (I) < 0 \ ? I387_CW_ANY \ : get_attr_i387_cw (I)) *************** extern rtx ix86_compare_op1; /* operand *** 2981,2987 **** are to be inserted. */ #define EMIT_MODE_SET(ENTITY, MODE, HARD_REGS_LIVE) \ ! ((MODE) != I387_CW_ANY \ ? emit_i387_cw_initialization (assign_386_stack_local (HImode, 1), \ assign_386_stack_local (HImode, 2), \ MODE), 0 \ --- 2981,2987 ---- are to be inserted. */ #define EMIT_MODE_SET(ENTITY, MODE, HARD_REGS_LIVE) \ ! ((MODE) != I387_CW_ANY && (MODE) != I387_CW_UNINITIALIZED \ ? emit_i387_cw_initialization (assign_386_stack_local (HImode, 1), \ assign_386_stack_local (HImode, 2), \ MODE), 0 \ Index: config/i386/i386.md =================================================================== RCS file: /cvs/gcc/gcc/gcc/config/i386/i386.md,v retrieving revision 1.558 diff -c -3 -p -r1.558 i386.md *** config/i386/i386.md 8 Sep 2004 05:08:26 -0000 1.558 --- config/i386/i386.md 9 Sep 2004 08:18:03 -0000 *************** *** 431,437 **** ;; Defines rounding mode of an FP operation. ! (define_attr "i387_cw" "floor,ceil,trunc,mask_pm,any" (const_string "any")) ;; Describe a user's asm statement. --- 431,437 ---- ;; Defines rounding mode of an FP operation. ! (define_attr "i387_cw" "floor,ceil,trunc,mask_pm,uninitialized,any" (const_string "any")) ;; Describe a user's asm statement.