From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 7961 invoked by alias); 20 Aug 2015 12:26:07 -0000 Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org Received: (qmail 7907 invoked by uid 48); 20 Aug 2015 12:26:03 -0000 From: "rguenth at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug middle-end/67285] ICE with (rdiv (POW:s @0 REAL_CST@1) @0) Date: Thu, 20 Aug 2015 12:26:00 -0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: middle-end X-Bugzilla-Version: unknown X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: rguenth at gcc dot gnu.org X-Bugzilla-Status: ASSIGNED X-Bugzilla-Resolution: X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: rguenth at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: Message-ID: In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 7bit X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 X-SW-Source: 2015-08/txt/msg01426.txt.bz2 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67285 --- Comment #4 from Richard Biener --- There are two issues here - one is side-effects (virtual definition) and one is dependences (virtual uses). The first one you hit with -fmath-errno, the second you hit with -frounding-math. On GENERIC there can be nothing "inbetween" components of the matched expression so things are usually fine. On GIMPLE there can be random statements inbetween the statements composing the matched expression. Like _1 = pow (x, 2) fesetround(); _2 = _1 / x; we may not move pow () across fesetround () with -frounding-math, thus we may not generate the expression replacement at the point of the _2 definition. The actual ICE is about our failure to keep the virtual operand SSA form up-to-date in fold_stmt. As we generally do not want to do IL walks to find a suitable VUSE/DEF we can use for that (apart from looking at the current statement) we generally have to fail doing the expression replacement. Implementation-wise the easiest is to "fail" when we are trying to generate a builtin function call which is not CONST. That doesn't avoid all questionable transforms but at least should avoid the ICEs due to non-up-to-date virtual operand form. There are cases we could relax (like replacing a call with another call), but let's do that separately. Note that this will require -fno-math-errno for any late transforms regarding to math builtins.