From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 19347 invoked by alias); 9 Nov 2012 06:06:03 -0000 Received: (qmail 19271 invoked by uid 48); 9 Nov 2012 06:05:45 -0000 From: "xinliangli at gmail dot com" To: gcc-bugs@gcc.gnu.org Subject: [Bug c++/55245] Compiler segfault when compiling the small test case Date: Fri, 09 Nov 2012 06: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: xinliangli at gmail dot com X-Bugzilla-Status: UNCONFIRMED X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Changed-Fields: 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-11/txt/msg00801.txt.bz2 http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55245 --- Comment #2 from davidxl 2012-11-09 06:05:43 UTC --- (In reply to comment #1) > The problem actually exists in main line compiler too. This is another test case. Segfaults without option, but builds ok with -DOK. The problem seems to be that the main variant of the array type Vector2[2] does not have size, while the variant Vector2_f[2] has. The variant's size later gets reset to 0 (from main variant). David template class Vector2 { public: Vector2(); VType x() const; }; typedef Vector2 Vector2_f; void GetR(const Vector2_f mosaic_position[3]); template struct DefaultDeleter { float GetColorTexCoord(Vector2_f &tex_coord) const { return tex_coord.x(); } }; class GetT { private: virtual void TestBody(); }; void GetT::TestBody() { #ifdef OK Vector2 mosaic_position[2][3] = { }; #else Vector2_f mosaic_position[2][3] = { }; #endif }