From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 44567 invoked by alias); 7 Dec 2018 15:55:50 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Received: (qmail 44555 invoked by uid 89); 7 Dec 2018 15:55:49 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-1.4 required=5.0 tests=BAYES_00,KAM_NUMSUBJECT,SPF_HELO_PASS autolearn=no version=3.3.2 spammy= X-HELO: mx1.redhat.com Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Fri, 07 Dec 2018 15:55:48 +0000 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 8C8193082130; Fri, 7 Dec 2018 15:55:47 +0000 (UTC) Received: from tucnak.zalov.cz (ovpn-117-214.ams2.redhat.com [10.36.117.214]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 0EABE6E715; Fri, 7 Dec 2018 15:55:46 +0000 (UTC) Received: from tucnak.zalov.cz (localhost [127.0.0.1]) by tucnak.zalov.cz (8.15.2/8.15.2) with ESMTP id wB7FtiHd010435; Fri, 7 Dec 2018 16:55:45 +0100 Received: (from jakub@localhost) by tucnak.zalov.cz (8.15.2/8.15.2/Submit) id wB7FtgV0010434; Fri, 7 Dec 2018 16:55:42 +0100 Date: Fri, 07 Dec 2018 15:55:00 -0000 From: Jakub Jelinek To: Wilco Dijkstra Cc: GCC Patches , nd Subject: Re: [PATCH v2] Fix PR64242 Message-ID: <20181207155542.GL12380@tucnak> Reply-To: Jakub Jelinek References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.9.2 (2017-12-15) X-IsSubscribed: yes X-SW-Source: 2018-12/txt/msg00475.txt.bz2 On Fri, Dec 07, 2018 at 02:52:48PM +0000, Wilco Dijkstra wrote: > - struct __attribute__((aligned (32))) S { int a[4]; } s; > - bar (&s); Any reason to remove the above? > p = __builtin_alloca (x); > + q = __builtin_alloca (x); > if (!__builtin_setjmp (buf)) > broken_longjmp (buf); > > + /* Compute expected next alloca offset - some targets don't align properly > + and allocate too much. */ > + p = q + (q - p); This is UB, pointer difference is only defined within the same object. So, you can only do such subtraction in some integral type rather than as pointer subtraction. > + > /* Fails if stack pointer corrupted. */ > - q = __builtin_alloca (x); > - if (foo (p) < foo (q)) > - { > - if (foo (q) - foo (p) >= 1024) > - abort (); > - } > - else if (foo (p) - foo (q) >= 1024) > + if (p != __builtin_alloca (x)) And I'm not sure you have a guarantee that every zero sized alloca is at the same offset from the previous one. Jakub