From patchwork Sun Sep 25 12:36:19 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Joern Rennecke X-Patchwork-Id: 116285 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) by ozlabs.org (Postfix) with SMTP id 1B0C9B6F72 for ; Sun, 25 Sep 2011 22:36:36 +1000 (EST) Received: (qmail 1012 invoked by alias); 25 Sep 2011 12:36:34 -0000 Received: (qmail 866 invoked by uid 22791); 25 Sep 2011 12:36:33 -0000 X-SWARE-Spam-Status: No, hits=-1.7 required=5.0 tests=AWL, BAYES_00, MIME_QP_LONG_LINE, TW_CP X-Spam-Check-By: sourceware.org Received: from c60.cesmail.net (HELO c60.cesmail.net) (216.154.195.49) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Sun, 25 Sep 2011 12:36:20 +0000 Received: from unknown (HELO epsilon2) ([192.168.1.60]) by c60.cesmail.net with ESMTP; 25 Sep 2011 08:36:20 -0400 Received: from host-92-29-223-192.as13285.net (host-92-29-223-192.as13285.net [92.29.223.192]) by webmail.spamcop.net (Horde MIME library) with HTTP; Sun, 25 Sep 2011 08:36:19 -0400 Message-ID: <20110925083619.amfz0d03kwwogo0c-nzlynne@webmail.spamcop.net> Date: Sun, 25 Sep 2011 08:36:19 -0400 From: Joern Rennecke To: gcc-patches@gcc.gnu.org Subject: Ping: RFA: Testsuite fixes (2/3): struct padding / alignment MIME-Version: 1.0 User-Agent: Internet Messaging Program (IMP) H3 (4.1.4) Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Delivered-To: mailing list gcc-patches@gcc.gnu.org This patch has not been reviewed for eight weeks. ----- Forwarded message from amylaar@spamcop.net ----- Date: Mon, 01 Aug 2011 01:01:13 -0400 From: Joern Rennecke Reply-To: Joern Rennecke Subject: RFA: Testsuite fixes (2/3): struct padding / alignment To: gcc-patches@gcc.gnu.org I am working with a target port that adds alignment and/or padding to certain structures. This causes some tests to fail that assume such padding does not exist. Fixed by adding a packed attribute to the structures in question. Regression tested with x86_64-unknown-linux-gnu X sh-elf . No change there, as there is no such added alignment / padding by default on that target. (Although there is the -mpadstruct option; but you'd need to build appropriate mutilibs to test that.) ----- End forwarded message ----- 2011-07-27 Joern Rennecke * g++.dg/ext/strncpy-chk1.C (struct A): Add packed attribute. 2011-07-21 Joern Rennecke * gcc.dg/builtin-object-size-10.c (drone_source_packet): Make packed. * gcc.dg/builtin-stringop-chk-1.c (t): Make packed. Index: gcc.dg/builtin-object-size-10.c =================================================================== --- gcc.dg/builtin-object-size-10.c (.../GNU/fsf-gcc/trunk/gcc/testsuite) (revision 2013) +++ gcc.dg/builtin-object-size-10.c (.../Customer-Projects/X/branches/Y-20110628/toolchain/gcc-4.7.0-20110701/gcc/testsuite) (revision 2013) @@ -8,7 +8,7 @@ typedef struct { char type_str[16]; char channel_hop; -} drone_source_packet; +} __attribute__((packed)) drone_source_packet; drone_packet * foo(char *x) { Index: gcc.dg/builtin-stringop-chk-1.c =================================================================== --- gcc.dg/builtin-stringop-chk-1.c (.../GNU/fsf-gcc/trunk/gcc/testsuite) (revision 2013) +++ gcc.dg/builtin-stringop-chk-1.c (.../Customer-Projects/X/branches/Y-20110628/toolchain/gcc-4.7.0-20110701/gcc/testsuite) (revision 2013) @@ -104,7 +104,7 @@ test2 (const H h) S *s[3]; memset (s, 0, sizeof (S) * 3); /* { dg-warning "will always overflow" "memset" } */ - struct T { char a[8]; char b[4]; char c[10]; } t; + struct T { char a[8]; char b[4]; char c[10]; } __attribute__((packed)) t; stpcpy (t.c,"Testing..."); /* { dg-warning "will always overflow" "stpcpy" } */ char b1[7]; Index: g++.dg/ext/strncpy-chk1.C =================================================================== --- g++.dg/ext/strncpy-chk1.C (.../GNU/fsf-gcc/trunk/gcc/testsuite) (revision 2013) +++ g++.dg/ext/strncpy-chk1.C (.../Customer-Projects/X/branches/Y-20110628/toolchain/gcc-4.7.0-20110701/gcc/testsuite) (revision 2013) @@ -2,7 +2,7 @@ // { dg-do compile } // { dg-options "-O2" } -struct A { char x[12], y[35]; }; +struct A { char x[12], y[35]; } __attribute__((packed)); struct B { char z[50]; }; inline void