From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 4593 invoked by alias); 22 Nov 2013 13:24:26 -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 4547 invoked by uid 48); 22 Nov 2013 13:24:22 -0000 From: "mpolacek at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug middle-end/59250] usan: ICE (segfault) with -fsanitize=undefined in ubsan_create_data Date: Fri, 22 Nov 2013 13:24: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: 4.9.0 X-Bugzilla-Keywords: ice-on-valid-code X-Bugzilla-Severity: normal X-Bugzilla-Who: mpolacek at gcc dot gnu.org X-Bugzilla-Status: UNCONFIRMED X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned 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: 2013-11/txt/msg02312.txt.bz2 http://gcc.gnu.org/bugzilla/show_bug.cgi?id=59250 --- Comment #1 from Marek Polacek --- Yeah, I bet this hunk --- gcc/ubsan.c.jj 2013-11-22 01:40:03.000000000 +0100 +++ gcc/ubsan.c 2013-11-22 10:05:29.491725405 +0100 @@ -227,8 +227,8 @@ ubsan_source_location (location_t loc) xloc = expand_location (loc); /* Fill in the values from LOC. */ - size_t len = strlen (xloc.file); - tree str = build_string (len + 1, xloc.file); + size_t len = xloc.file ? strlen (xloc.file) : 0; + tree str = build_string (len + 1, xloc.file ? xloc.file : ""); TREE_TYPE (str) = build_array_type (char_type_node, build_index_type (size_int (len))); TREE_READONLY (str) = 1; @@ -642,7 +642,7 @@ ubsan_pass (void) { struct walk_stmt_info wi; gimple stmt = gsi_stmt (gsi); - if (is_gimple_debug (stmt)) + if (is_gimple_debug (stmt) || gimple_clobber_p (stmt)) { gsi_next (&gsi); continue; from Jakub's recent patch (http://gcc.gnu.org/ml/gcc-patches/2013-11/msg02831.html) will fix it.