From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 5549 invoked by alias); 7 Nov 2011 00:06:58 -0000 Received: (qmail 5539 invoked by uid 22791); 7 Nov 2011 00:06:57 -0000 X-SWARE-Spam-Status: No, hits=-2.8 required=5.0 tests=ALL_TRUSTED,AWL,BAYES_00,TW_DN X-Spam-Check-By: sourceware.org Received: from localhost (HELO gcc.gnu.org) (127.0.0.1) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Mon, 07 Nov 2011 00:06:44 +0000 From: "froydnj at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug c++/42129] ICE in pointer difference with sizeof(int)>sizeof(void *) Date: Mon, 07 Nov 2011 00:06:00 -0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: c++ X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: froydnj at gcc dot gnu.org X-Bugzilla-Status: NEW X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Changed-Fields: Status Last reconfirmed Ever Confirmed Message-ID: In-Reply-To: References: X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated Content-Type: text/plain; charset="UTF-8" MIME-Version: 1.0 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 X-SW-Source: 2011-11/txt/msg00544.txt.bz2 http://gcc.gnu.org/bugzilla/show_bug.cgi?id=42129 Nathan Froyd changed: What |Removed |Added ---------------------------------------------------------------------------- Status|UNCONFIRMED |NEW Last reconfirmed| |2011-11-07 Ever Confirmed|0 |1 --- Comment #2 from Nathan Froyd 2011-11-07 00:06:11 UTC --- I can confirm that the problem still happens with the given options (-mh -mn -mint32). I don't know much about this target, but the equivalent C front-end code has: /* Determine integer type to perform computations in. This will usually be the same as the result type (ptrdiff_t), but may need to be a wider type if pointers for the address space are wider than ptrdiff_t. */ if (TYPE_PRECISION (restype) < TYPE_PRECISION (TREE_TYPE (op0))) inttype = lang_hooks.types.type_for_size (TYPE_PRECISION (TREE_TYPE (op0)), 0); else inttype = restype; and uses that as the result of the division, with a conversion to restype (ptrdiff_type_node) as in Paolo's patch. I think it'd be better to try to make the C and C++ front-ends as close as possible on this; I can try a patch that combines the above and Paolo's, but I'm not sure I'd get to it before stage 1 closes.