aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJakub Jelinek <jakub@redhat.com>2012-02-13 21:12:54 +0100
committerJakub Jelinek <jakub@gcc.gnu.org>2012-02-13 21:12:54 +0100
commite3793c6fb96a83d2d2bd62e0a9d94f879d720270 (patch)
treef148188cec03c88234c3986c9685d7dbc559628c
parent9abd5ed90b85306b6cfea640c9e01e486bbcddb1 (diff)
downloadgcc-e3793c6fb96a83d2d2bd62e0a9d94f879d720270.zip
gcc-e3793c6fb96a83d2d2bd62e0a9d94f879d720270.tar.gz
gcc-e3793c6fb96a83d2d2bd62e0a9d94f879d720270.tar.bz2
re PR c++/52215 (__atomic_compare_exchange_n for enumeration type changes signature with -m32)
PR c++/52215 * c-common.c (sync_resolve_params): Don't decide whether to convert or not based on TYPE_SIZE comparison, convert whenever arg_type is unsigned INTEGER_TYPE. * g++.dg/ext/atomic-1.C: New test. From-SVN: r184167
-rw-r--r--gcc/c-family/ChangeLog7
-rw-r--r--gcc/c-family/c-common.c12
-rw-r--r--gcc/testsuite/ChangeLog5
-rw-r--r--gcc/testsuite/g++.dg/ext/atomic-1.C12
4 files changed, 31 insertions, 5 deletions
diff --git a/gcc/c-family/ChangeLog b/gcc/c-family/ChangeLog
index b86ebe5..7b927b9 100644
--- a/gcc/c-family/ChangeLog
+++ b/gcc/c-family/ChangeLog
@@ -1,3 +1,10 @@
+2012-02-13 Jakub Jelinek <jakub@redhat.com>
+
+ PR c++/52215
+ * c-common.c (sync_resolve_params): Don't decide whether to convert
+ or not based on TYPE_SIZE comparison, convert whenever arg_type
+ is unsigned INTEGER_TYPE.
+
2012-02-06 Paolo Carlini <paolo.carlini@oracle.com>
PR c/52118
diff --git a/gcc/c-family/c-common.c b/gcc/c-family/c-common.c
index 8dbf6cc..1d19251 100644
--- a/gcc/c-family/c-common.c
+++ b/gcc/c-family/c-common.c
@@ -1,6 +1,6 @@
/* Subroutines shared by all languages that are variants of C.
Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000,
- 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011
+ 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012
Free Software Foundation, Inc.
This file is part of GCC.
@@ -9336,10 +9336,12 @@ sync_resolve_params (location_t loc, tree orig_function, tree function,
return false;
}
- /* Only convert parameters if the size is appropriate with new format
- sync routines. */
- if (orig_format
- || tree_int_cst_equal (TYPE_SIZE (ptype), TYPE_SIZE (arg_type)))
+ /* Only convert parameters if arg_type is unsigned integer type with
+ new format sync routines, i.e. don't attempt to convert pointer
+ arguments (e.g. EXPECTED argument of __atomic_compare_exchange_n),
+ bool arguments (e.g. WEAK argument) or signed int arguments (memmodel
+ kinds). */
+ if (TREE_CODE (arg_type) == INTEGER_TYPE && TYPE_UNSIGNED (arg_type))
{
/* Ideally for the first conversion we'd use convert_for_assignment
so that we get warnings for anything that doesn't match the pointer
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index 4e47166..207e5cf 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,8 @@
+2012-02-13 Jakub Jelinek <jakub@redhat.com>
+
+ PR c++/52215
+ * g++.dg/ext/atomic-1.C: New test.
+
2012-02-13 Andreas Krebbel <Andreas.Krebbel@de.ibm.com>
* gcc.c-torture/execute/pr51933.c: Modify for s390 31 bit.
diff --git a/gcc/testsuite/g++.dg/ext/atomic-1.C b/gcc/testsuite/g++.dg/ext/atomic-1.C
new file mode 100644
index 0000000..58069c3
--- /dev/null
+++ b/gcc/testsuite/g++.dg/ext/atomic-1.C
@@ -0,0 +1,12 @@
+// PR c++/52215
+// { dg-do compile }
+
+enum E { ZERO };
+
+int
+main ()
+{
+ E e = ZERO;
+ __atomic_compare_exchange_n (&e, &e, e, true, __ATOMIC_ACQ_REL,
+ __ATOMIC_RELAXED);
+}