From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on dcvr.yhbt.net X-Spam-Level: X-Spam-ASN: AS22989 209.51.188.0/24 X-Spam-Status: No, score=-3.7 required=3.0 tests=AWL,BAYES_00,DKIM_INVALID, DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI,RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,SPF_PASS shortcircuit=no autolearn=ham autolearn_force=no version=3.4.6 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dcvr.yhbt.net (Postfix) with ESMTPS id BA9DC1F47C for ; Fri, 27 Jan 2023 19:48:28 +0000 (UTC) Authentication-Results: dcvr.yhbt.net; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=clisp.org header.i=@clisp.org header.a=rsa-sha256 header.s=strato-dkim-0002 header.b=RJGUePw2; dkim-atps=neutral Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pLUhn-0005bC-Ku; Fri, 27 Jan 2023 14:48:11 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pLUh6-0005Xj-Hp for bug-gnulib@gnu.org; Fri, 27 Jan 2023 14:48:09 -0500 Received: from mo4-p00-ob.smtp.rzone.de ([81.169.146.161]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pLUh4-00019h-1G for bug-gnulib@gnu.org; Fri, 27 Jan 2023 14:47:27 -0500 ARC-Seal: i=1; a=rsa-sha256; t=1674848842; cv=none; d=strato.com; s=strato-dkim-0002; b=SMFFGogLqdAArqJzYaApdZD6bMwMBQvk7SdZWQGoildFWUgvxNLbcU1WI6hUXEiLmM E18kqgDov6iGmQdAxtUzSOMGOerC7GgA9Ue0LyIc6olXUbhBvAPwuXoodG4Cv9/+Xq8m K7wuY0B/pWNsrc88qXSVFzFUWDRgkPx4Vn4mPsCLYKVNnPGmZfUiRKMfPCamLFng4Mea hrvLpf5bOtGeuaprfOjQTotDGsjGh/5zr1KkeeqrrGb5abuFk/VwjKDbYcglJKHh5xk1 9ZE8ovwy7CEgvt3szvPHmpqDbNfqzuv60PZR9mlEHDara8dMK519RR289TCqiUEz5Vnh Ogwg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; t=1674848842; s=strato-dkim-0002; d=strato.com; h=Message-ID:Date:Subject:To:From:Cc:Date:From:Subject:Sender; bh=AHPiB/9LZtrX/DgG/z7SItuE5gf9hK4Z2aMbD1dZXME=; b=sgwH3t3TSoYOzmxzvHgQb7S9MO57R/COYlogwyqzpdGrGZ0V7IZaMsA6aLcgRe1dPV 2BEigi+gQPDLEVVkhBeyVjmwdLEg2IjomqjuwYe26PACQ2/mp9R53ZSIW3cEc30GuI2c JLGhdg4EHF40oJQH2c4hFcvJFFEsaO2fprYNyIGp1JLOqHEVkumlAdbPsOQxR+MDqzu4 Asb5+ik2+B5DuOMiC/LuJ9haM596qh3tPvArvLKl49eXeYkuN8BBnXYaMODam2Ye91gD xcCYNH74AOox7LdxNXjPMnNW8PsC9MPiNFAXLNaMY06olgoPoS3PpzsZNifRSe9w2Muq IfJQ== ARC-Authentication-Results: i=1; strato.com; arc=none; dkim=none X-RZG-CLASS-ID: mo00 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; t=1674848842; s=strato-dkim-0002; d=clisp.org; h=Message-ID:Date:Subject:To:From:Cc:Date:From:Subject:Sender; bh=AHPiB/9LZtrX/DgG/z7SItuE5gf9hK4Z2aMbD1dZXME=; b=RJGUePw2uSvavKSgAxryWFbPIFI/3N9KFvi/2y4nYFVrWNaA/0gPCRZmASs0CStirb bFqmY7p6DDWL4dW6s6TtPLA/2s8uLGTybUHApJ4yU3BEsHtqdwGFHZ0C5JKaujFh+r7m cngHudw4GoujR2mfayRcwe3gneZ6rOGfgjmB6RaEUp7kR5qLYNfI0Cfm8QT1XxJ8PIW2 jqJq03Yy/NXaCnNVrs/RClwa34MOVqP6d7uYrkZPIwLlHjUChLhyx0d8x/niY7GbTYwj pmssL5ivkv/wf4OC2/q7yV/IKaJZdI4UA8b26aAUGbVG2oyKfIE5FUMuRKLrJwBjnS1X VkQA== X-RZG-AUTH: ":Ln4Re0+Ic/6oZXR1YgKryK8brlshOcZlIWs+iCP5vnk6shH0WWb0LN8XZoH94zq68+3cfpPC1fRnY/uhEThtxiqEVN2E/k+dkw==" Received: from nimes.localnet by smtp.strato.de (RZmta 49.2.2 AUTH) with ESMTPSA id 098542z0RJlMLrr (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256 bits)) (Client did not present a certificate); Fri, 27 Jan 2023 20:47:22 +0100 (CET) From: Bruno Haible To: bug-gnulib@gnu.org Subject: stddef: Fix test-stddef compilation error on FreeBSD 12/x86 Date: Fri, 27 Jan 2023 20:47:22 +0100 Message-ID: <2511333.SWmJFuOJt8@nimes> MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" Received-SPF: none client-ip=81.169.146.161; envelope-from=bruno@clisp.org; helo=mo4-p00-ob.smtp.rzone.de X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_PASS=-0.001, SPF_NONE=0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: bug-gnulib@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gnulib discussion list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnulib-bounces+normalperson=yhbt.net@gnu.org Sender: bug-gnulib-bounces+normalperson=yhbt.net@gnu.org On FreeBSD 12.0/x86, on the stable-202301 branch, I'm seeing this compilation error: ../../gltests/test-stddef.c:62:1: error: static_assert failed "static assertion failed" static_assert (__alignof__ (double) <= __alignof__ (max_align_t)); ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /usr/include/assert.h:73:23: note: expanded from macro 'static_assert' #define static_assert _Static_assert ^ ../gllib/assert.h:256:7: note: expanded from macro '_Static_assert' _GL_STATIC_ASSERT (__VA_ARGS__, "static assertion failed", -) ^ ~~~~~~~~~~~ ../gllib/assert.h:241:48: note: expanded from macro '_GL_STATIC_ASSERT' # define _GL_STATIC_ASSERT(R, DIAGNOSTIC, ...) _Static_assert (R, DIAGNOSTIC) ^ ~ 1 error generated. What happens is that the fix for a wrong _Alignof that we have in the stdalign / alignasof module causes max_align_t to have too small alignment. | original | ISO C compliant | | _Alignof | _Alignof | --------------+--------------+-------------------+ long long | 8 | 4 | --------------+--------------+-------------------+ double | 8 | 4 | --------------+--------------+-------------------+ long double | 4 | 4 | --------------+--------------+-------------------+ max_align_t being defined through _Alignof(long long) and _Alignof(long double), it alignment shrinks from 8 to 4, and thus __alignof__ (double) <= __alignof__ (max_align_t) is no longer fulfilled. This patch fixes it: the configure test "checking for good max_align_t..." now reports no instead of yes, and max_align_t gets overridden. 2023-01-27 Bruno Haible stddef: Fix test-stddef compilation error on FreeBSD 12/x86. * m4/stddef_h.m4 (gl_STDDEF_H): When testing for good max_align_t, use an ISO C compliant definition of _Alignof. diff --git a/m4/stddef_h.m4 b/m4/stddef_h.m4 index c0553d6f2f..a2322ebb7e 100644 --- a/m4/stddef_h.m4 +++ b/m4/stddef_h.m4 @@ -1,4 +1,4 @@ -# stddef_h.m4 serial 12 +# stddef_h.m4 serial 13 dnl Copyright (C) 2009-2023 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, @@ -22,7 +22,14 @@ AC_DEFUN_ONCE([gl_STDDEF_H], [gl_cv_type_max_align_t], [AC_COMPILE_IFELSE( [AC_LANG_PROGRAM( - [[#include + [[/* On FreeBSD 12.0/x86, max_align_t defined by has + the correct alignment with the default (wrong) definition of + _Alignof, but a wrong alignment as soon as we activate an + ISO C compliant _Alignof definition. */ + #if ((defined __GNUC__ && 4 <= __GNUC__) || defined __clang__) && !defined __cplusplus + #define _Alignof(type) __builtin_offsetof (struct { char __a; type __b; }, __b) + #endif + #include unsigned int s = sizeof (max_align_t); #if defined __GNUC__ || defined __clang__ || defined __IBM__ALIGNOF__ int check1[2 * (__alignof__ (double) <= __alignof__ (max_align_t)) - 1];