From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 30380 invoked by alias); 21 Mar 2003 11:46:04 -0000 Mailing-List: contact gcc-prs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Archive: List-Post: List-Help: Sender: gcc-prs-owner@gcc.gnu.org Received: (qmail 30338 invoked by uid 71); 21 Mar 2003 11:46:03 -0000 Resent-Date: 21 Mar 2003 11:46:03 -0000 Resent-Message-ID: <20030321114603.30337.qmail@sources.redhat.com> Resent-From: gcc-gnats@gcc.gnu.org (GNATS Filer) Resent-Cc: gcc-prs@gcc.gnu.org, gcc-bugs@gcc.gnu.org, magallon@unizar.es Resent-Reply-To: gcc-gnats@gcc.gnu.org, jamagallon@able.es Received: (qmail 27854 invoked by uid 48); 21 Mar 2003 11:39:03 -0000 Message-Id: <20030321113903.27853.qmail@sources.redhat.com> Date: Fri, 21 Mar 2003 11:46:00 -0000 From: jamagallon@able.es Reply-To: jamagallon@able.es To: gcc-gnats@gcc.gnu.org Cc: magallon@unizar.es X-Send-Pr-Version: gnatsweb-2.9.3 (1.1.1.1.2.31) X-GNATS-Notify: magallon@unizar.es Subject: c++/10179: alignment attributes are not inherited correctly with empty classes X-SW-Source: 2003-03/txt/msg01387.txt.bz2 List-Id: >Number: 10179 >Category: c++ >Synopsis: alignment attributes are not inherited correctly with empty classes >Confidential: no >Severity: serious >Priority: medium >Responsible: unassigned >State: open >Class: sw-bug >Submitter-Id: net >Arrival-Date: Fri Mar 21 11:46:01 UTC 2003 >Closed-Date: >Last-Modified: >Originator: jamagallon@able.es >Release: gcc-3.2.2 >Organization: >Environment: Linux Mandrake 9.1 >Description: __attribute__((__aligned__(16))) is applied to an empty base class, used just to propagate that and new/delete operators, not defined in the example (do you remember SSE...). If derived class T is smaller than the alignment, it is obeyed so arrays of T give aligned alements. If size of T is bigger that alignment, elements in T[] are unaligned. If base is not empty, it works ok. Is this expected behaviour ? >How-To-Repeat: #include using namespace std; #define __class class __attribute__((__aligned__(16))) __class A { public: void id() { cout << this << endl; }; }; class T : public A { public: // with 3 floats, sizeof(T)==16 // with 5 floats, sizeof(T)==20 float f[5]; }; int main() { A a; cout << "sizeof(A) = " << sizeof(A) << endl; cout << &a << endl; A aa[2]; cout << "sizeof(A[2]) = " << sizeof(aa) << endl; cout << &aa[0] << endl; cout << &aa[1] << endl; T t; cout << "sizeof(T) = " << sizeof(T) << endl; cout << &t << endl; T tt[2]; cout << "sizeof(T[2]) = " << sizeof(tt) << endl; cout << &tt[0] << endl; cout << &tt[1] << endl; return 0; } >Fix: >Release-Note: >Audit-Trail: >Unformatted: