From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 3457 invoked by alias); 11 Jan 2012 15:58:26 -0000 Received: (qmail 3447 invoked by uid 22791); 11 Jan 2012 15:58:24 -0000 X-SWARE-Spam-Status: No, hits=-2.9 required=5.0 tests=ALL_TRUSTED,AWL,BAYES_00 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; Wed, 11 Jan 2012 15:58:11 +0000 From: "rguenth at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug c/8081] ICE with variably sized types returned from nested functions Date: Wed, 11 Jan 2012 15:58: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: accepts-invalid, ice-on-invalid-code X-Bugzilla-Severity: normal X-Bugzilla-Who: rguenth at gcc dot gnu.org X-Bugzilla-Status: NEW X-Bugzilla-Priority: P2 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Changed-Fields: Keywords Component Summary Known to fail 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: 2012-01/txt/msg01282.txt.bz2 http://gcc.gnu.org/bugzilla/show_bug.cgi?id=8081 Richard Guenther changed: What |Removed |Added ---------------------------------------------------------------------------- Keywords|ice-on-valid-code |accepts-invalid, | |ice-on-invalid-code Component|middle-end |c Summary|ICE with variably sized |ICE with variably sized |types and nested functions |types returned from nested | |functions Known to fail| |4.7.0 --- Comment #23 from Richard Guenther 2012-01-11 15:57:03 UTC --- In PR21374 it was decided to reject the testcase which makes this a C frontend issue. Testcase that still ICEs on the trunk even when optimizing: int main (int argc, char **argv) { int size = 10; typedef struct { char val[size]; } block; block b; block __attribute__((noinline)) retframe_block () { return *(block *) &b; } b=retframe_block (); return 0; } as alternative to rejecting this case we can lower returning variable-size types during un-nesting to explicit passing of a return slot and using memcpy, making the nested function return nothing.