From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 862 invoked by alias); 27 Jan 2015 00:08:12 -0000 Mailing-List: contact gcc-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-owner@gcc.gnu.org Received: (qmail 464 invoked by uid 89); 27 Jan 2015 00:08:07 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-1.3 required=5.0 tests=AWL,RCVD_IN_DNSWL_LOW,SPF_PASS autolearn=ham version=3.3.2 X-HELO: relay1.mentorg.com Received: from relay1.mentorg.com (HELO relay1.mentorg.com) (192.94.38.131) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Tue, 27 Jan 2015 00:08:06 +0000 Received: from nat-ies.mentorg.com ([192.94.31.2] helo=SVR-IES-FEM-01.mgc.mentorg.com) by relay1.mentorg.com with esmtp id 1YFthJ-000164-OK from joseph_myers@mentor.com ; Mon, 26 Jan 2015 16:08:01 -0800 Received: from digraph.polyomino.org.uk (137.202.0.76) by SVR-IES-FEM-01.mgc.mentorg.com (137.202.0.104) with Microsoft SMTP Server id 14.3.224.2; Tue, 27 Jan 2015 00:08:00 +0000 Received: from jsm28 (helo=localhost) by digraph.polyomino.org.uk with local-esmtp (Exim 4.82) (envelope-from ) id 1YFthG-0000br-M4; Tue, 27 Jan 2015 00:07:58 +0000 Date: Tue, 27 Jan 2015 00:08:00 -0000 From: Joseph Myers To: Martin Uecker CC: gcc Mailing List , Jeff Law , Jakub Jelinek , Marek Polacek , Florian Weimer , "Balaji V. Iyer" Subject: Re: array bounds, sanitizer, safe programming, and cilk array notation In-Reply-To: <20150126115359.295659da@lemur> Message-ID: References: <20150126115359.295659da@lemur> User-Agent: Alpine 2.10 (DEB 1266 2009-07-14) MIME-Version: 1.0 Content-Type: text/plain; charset="US-ASCII" X-SW-Source: 2015-01/txt/msg00243.txt.bz2 On Mon, 26 Jan 2015, Martin Uecker wrote: > extern void bar2(int (*x)[5]); > int c = 4; > int y[c]; > bar2(&y); // not diagnosed (found by asan) This is the undefined behavior "If the two array types are used in a context which requires them to be compatible, it is undefined behavior if the two size specifiers evaluate to unequal values." (C11 6.7.6.2#6). Yes, it would make sense for ubsan to detect this. Generally, most forms of runtime undefined behavior listed in J.2 should have ubsan detection unless hard to detect / detected by some other sanitizer such as asan. Does adding new forms of sanitization require upstream libsanitizer changes as well or can arbitrary ubsan checks be added without needing libsanitizer changes? -- Joseph S. Myers joseph@codesourcery.com