This is the mail archive of the mailing list for the GCC project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

PING: PATCH to place_field for c++/42837 (abi/packed1.C failure on non-strict aligment targets)

-------- Original Message --------
Subject: RFA: PATCH to place_field for c++/42837 (abi/packed1.C failure on strict aligment targets)
Date: Fri, 19 Feb 2010 10:53:53 -0500
From: Jason Merrill <>
To: gcc-patches List <>
CC: H.J. Lu <>

On 02/19/2010 12:15 AM, H.J. Lu wrote:
The test failed on Linux/ia32:

FAIL: g++.dg/abi/packed1.C (test for excess errors)

Oops. This patch fixes that; it doesn't make sense to warn about a particular field being unnecessarily packed if the whole type is.

Testing now. OK for trunk if it passes?

commit a9c1e61ebe0fd53c4892b17d23ac59f9175d8894
Author: Jason Merrill <>
Date:   Fri Feb 19 10:45:57 2010 -0500

    	PR c++/42837
    	* stor-layout.c (place_field): Don't warn about unnecessary DECL_PACKED
    	if the type is packed.

diff --git a/gcc/stor-layout.c b/gcc/stor-layout.c
index 6f08d8c..1806c12 100644
--- a/gcc/stor-layout.c
+++ b/gcc/stor-layout.c
@@ -1100,7 +1100,8 @@ place_field (record_layout_info rli, tree field)
 		warning (OPT_Wattributes, "packed attribute causes "
                          "inefficient alignment for %q+D", field);
-	      else
+	      /* Don't warn if DECL_PACKED was set by the type.  */
+	      else if (!TYPE_PACKED (rli->t))
 		warning (OPT_Wattributes, "packed attribute is "
 			 "unnecessary for %q+D", field);

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]