From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from filter02-ipv6-out13.totaalholding.nl (filter02-ipv6-out13.totaalholding.nl [IPv6:2a02:40c0:1000:1000:0:2:ffff:13]) by sourceware.org (Postfix) with ESMTPS id B1B6C3840C1F for ; Mon, 22 Feb 2021 09:37:36 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org B1B6C3840C1F Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=cyberfiber.eu Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=mjbaars1977.gcc@cyberfiber.eu Received: from www98.totaalholding.nl ([185.94.230.81]) by filter02.totaalholding.nl with esmtps (TLSv1.2:AES128-GCM-SHA256:128) (Exim 4.92) (envelope-from ) id 1lE7eo-0002Tt-K5 for gcc@gcc.gnu.org; Mon, 22 Feb 2021 10:37:35 +0100 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=cyberfiber.eu; s=default; h=Content-Transfer-Encoding:MIME-Version: Content-Type:References:In-Reply-To:Date:Cc:To:From:Subject:Message-ID:Sender :Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help: List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=uJBoqmb20AESWIZNsJyyi5m2Layyiy5w27GvfUr/XJs=; b=xO4g/dl0dv4jEnuRJOXC0AEzii iB5pOMwUKQveAX9ZVa0X7SHiFHDML2UmuXlGjWQK4rqykolab4sEA4n4o/n2rGaFEbUxHapfK311O O1dGhu28ddOrl876T/TFxl+HYE31AL0Rk1AScuLmfhmeMbA2vN2qcHPlfjJxoaKcESnA8J0mQ6jyC L8Ec8OMAPh6RWDQ0aftk3PM9ahopvl1vJbvDoUBoIfekj9nABJIsPOAkiVQeKXORmndYDQtEhfMfp qpuCsllMv4jelONQz3iV8TVR1vxJ3mlB0dd+9zHYizkwsVwgD8w3iHgYXSQuCvDO329xtLlWmU35B B3y3Uz+A==; Received: from 82-94-23-232.ip.xs4all.nl ([82.94.23.232]:48582 helo=tp06.long4more.com) by www98.totaalholding.nl with esmtpsa (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.93) (envelope-from ) id 1lE7em-0006qG-O4; Mon, 22 Feb 2021 10:37:32 +0100 Message-ID: Subject: Re: problems with memory allocation and the alignment check From: "Michael J. Baars" To: Andrew Pinski Cc: GCC Mailing List , LKML Date: Mon, 22 Feb 2021 10:37:33 +0100 In-Reply-To: References: <80753cbc54ef69b4fc136f791666197fc8b1f8bb.camel@cyberfiber.eu> Content-Type: text/plain; charset="UTF-8" User-Agent: Evolution 3.36.5 (3.36.5-2.fc32) MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - www98.totaalholding.nl X-AntiAbuse: Original Domain - gcc.gnu.org X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12] X-AntiAbuse: Sender Address Domain - cyberfiber.eu X-Get-Message-Sender-Via: www98.totaalholding.nl: authenticated_id: mjbaars1977.gcc@cyberfiber.eu X-Authenticated-Sender: www98.totaalholding.nl: mjbaars1977.gcc@cyberfiber.eu X-Source: X-Source-Args: X-Source-Dir: X-Originating-IP: 185.94.230.81 X-SpamExperts-Domain: out.totaalholding.nl X-SpamExperts-Username: 185.94.230.81 Authentication-Results: totaalholding.nl; auth=pass smtp.auth=185.94.230.81@out.totaalholding.nl X-SpamExperts-Outgoing-Class: ham X-SpamExperts-Outgoing-Evidence: Combined (0.10) X-Recommended-Action: accept X-Filter-ID: Pt3MvcO5N4iKaDQ5O6lkdGlMVN6RH8bjRMzItlySaT86LOCQny59ksdOdRHzCf5PPUtbdvnXkggZ 3YnVId/Y5jcf0yeVQAvfjHznO7+bT5xBytxzJBgOlCIhBVn7zf5DAxQ+GhOWeJSm0X/4oD2rzZW8 bid/+XzDEq6/3cZjxxMh55uqY3MhMgFAHq5BxPxP/ijLoXGwg6cE8QkND5xqCP+OYyKZfpB+HfEy 0c1kHqvdCL2pes7KVf/S8Fu39p0KPF2o8E1RuGcuwbTREgYJtxMm+PEDT++3vCWn496q72rIW27x JD289kjnVjkxt+L8Htbll/plcfV8lw61v8yJq8ayOad/ofp5U0uXWC9rfD29GRbOwCBpaiXEjEKP YYe2jpq2zFoWRZL8o72CBW3vLXW/QcKr0iPdaChCh7Mz6xxpZZHt2sx3SpskijVFUJeJ7ZVcZ20v KiDu6LnR8m9k9VUOfMXv5a6okRmpSN2D7MTk6xV06FcgZkQoEFV+s1chVLvKs3jED+rkxy9HfVI3 2I9aal4vG7UAn6qJvbTvjuQZKCKOdhIpn5QtpJgaHrAc2+mjZSBX08/Qa05JAIPdanoSKlHMxVnk urBPHtW+f1JZBGKGpZFwJprvIwY1weIqGl4NeaWaStT3KfZ2FG3qbOJiWoyShg7A0kbP2mom+rK2 V1R9UjU1eB3aEzUSchLMJcqaANbLHasxeXJYXsXLuZM7Qbg9sfu7LDhdRWwAoezM/PFqE+qWB2Ex +ON9GuUcHAvZhEyfejztGtIuuaSVkeRcsBv4L0qEJDHhmXGi7myIuwMKV9tojzhFmK6DBPxByMp4 pvQm8asGSEPMmEFjyBJvOdcpCyCck7tl/8A3YmQccBIk1Sag4dKiqCrF8eZZ8uWZNKxNp4v6LdWg uO5Sdb8cJPhsB7jSAm7MYgXlopaOUKoqYjdgH+FxpkyXoFfeQ2K5UjhgJmfm3gS/XH6VT09aueIv vEXXrLiY+bjjllUBuuJ2vQaYkqpHIpqxcO6w5NpS3rE/TCb4GSlUZGHqBIEAHShADHyoug9KtENd BekfO4BT+UljiM6GTEOueDY8yUueh2Jv3gu4Rg4JLSbcvg== X-Report-Abuse-To: spam@filter01.totaalholding.nl X-Spam-Status: No, score=-2.5 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, RCVD_IN_DNSWL_LOW, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org X-BeenThere: gcc@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 22 Feb 2021 09:37:38 -0000 On Mon, 2021-02-22 at 01:29 -0800, Andrew Pinski wrote: > On Mon, Feb 22, 2021 at 1:17 AM Michael J. Baars > wrote: > > Hi, > > > > I just wrote this little program to demonstrate a possible flaw in both malloc and calloc. > > > > If I allocate a the simplest memory region from main(), one out of three optimization flags fail. > > If I allocate the same region from a function, three out of three optimization flags fail. > > > > Does someone know if this really is a flaw, and if so, is it a gcc or a kernel flaw? > > There is no flaw. GCC (kernel, glibc) all assume unaligned accesses > on x86 will not cause an exception. Is this just an assumption or more like a fact? I agree with you that byte aligned is more or less the same as unaligned. > > Thanks, > Andrew > > > Regards, > > Mischa.