From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from us-smtp-1.mimecast.com (us-smtp-1.mimecast.com [205.139.110.61]) by sourceware.org (Postfix) with ESMTP id 5B06E3861893 for ; Thu, 13 Aug 2020 12:25:51 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 5B06E3861893 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-290-duWOrXUJOlSkt_XcDi8OUA-1; Thu, 13 Aug 2020 08:25:48 -0400 X-MC-Unique: duWOrXUJOlSkt_XcDi8OUA-1 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 6720D1854FC0; Thu, 13 Aug 2020 12:25:47 +0000 (UTC) Received: from tucnak.zalov.cz (ovpn-113-174.ams2.redhat.com [10.36.113.174]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 3887D5DA66; Thu, 13 Aug 2020 12:25:45 +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 07DCPhIO013350; Thu, 13 Aug 2020 14:25:44 +0200 Received: (from jakub@localhost) by tucnak.zalov.cz (8.15.2/8.15.2/Submit) id 07DCPgeY013349; Thu, 13 Aug 2020 14:25:42 +0200 Date: Thu, 13 Aug 2020 14:25:42 +0200 From: Jakub Jelinek To: Tobias Burnus Cc: Aldy Hernandez , Jonathan Wakely , Andrew MacLeod via Gcc-patches Subject: Re: r11-2663 causes static_assert failure Message-ID: <20200813122542.GA2363@tucnak> Reply-To: Jakub Jelinek References: <20200807075746.GK3400@redhat.com> <20200807083438.GL3400@redhat.com> <20200807085508.GA2363@tucnak> <20200807091729.GO3400@redhat.com> <9c7c2c1e-3a96-2ee7-26dd-f3b42cf27a42@codesourcery.com> <20200813115212.GZ2363@tucnak> <22022e6e-324b-0e6b-241a-3266b347386d@codesourcery.com> MIME-Version: 1.0 In-Reply-To: <22022e6e-324b-0e6b-241a-3266b347386d@codesourcery.com> User-Agent: Mutt/1.11.3 (2019-02-01) X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-Mimecast-Spam-Score: 0.001 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset=us-ascii Content-Disposition: inline X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2, 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-patches@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 13 Aug 2020 12:25:53 -0000 On Thu, Aug 13, 2020 at 02:06:21PM +0200, Tobias Burnus wrote: > Build server is x86_64-gnu-linux, "i686-pc-linux-gnu-g++" is a native binary of GCC 5.2.0 > [Don't ask why i686 and not x86_64 is used.] Ah, ok, so this boils down to: int i = alignof (long long int); struct TTT { char a; long long int b; }; int j = alignof (TTT); ending up to be 8, 4 with -O2 -m32 in GCC 4.8 - 7.x and only in GCC 8+ 4, 4. So perhaps we want: --- gcc/vec.h.jj 2020-08-12 12:45:58.410686880 +0200 +++ gcc/vec.h 2020-08-13 14:18:06.967041880 +0200 @@ -1281,10 +1281,11 @@ template inline size_t vec::embedded_size (unsigned alloc) { - struct alignas (T) U { char data[sizeof (T)]; }; + struct V { char a; T b; }; + struct alignas (V) U { char data[sizeof (T)]; }; typedef vec vec_embedded; - static_assert (sizeof (vec_embedded) == sizeof(vec), ""); - static_assert (alignof (vec_embedded) == alignof(vec), ""); + static_assert (sizeof (vec_embedded) == sizeof (vec), ""); + static_assert (alignof (vec_embedded) == alignof (vec), ""); return offsetof (vec_embedded, m_vecdata) + alloc * sizeof (T); } or --- gcc/vec.h.jj 2020-08-12 12:45:58.410686880 +0200 +++ gcc/vec.h 2020-08-13 14:18:06.967041880 +0200 @@ -1281,10 +1281,11 @@ template inline size_t vec::embedded_size (unsigned alloc) { - struct alignas (T) U { char data[sizeof (T)]; }; + struct V { char a; T b; } *v; + struct alignas (alignof (v->b)) U { char data[sizeof (T)]; }; typedef vec vec_embedded; - static_assert (sizeof (vec_embedded) == sizeof(vec), ""); - static_assert (alignof (vec_embedded) == alignof(vec), ""); + static_assert (sizeof (vec_embedded) == sizeof (vec), ""); + static_assert (alignof (vec_embedded) == alignof (vec), ""); return offsetof (vec_embedded, m_vecdata) + alloc * sizeof (T); } ? Jakub