From: Andrew MacLeod Date: Wed, 14 Jan 2015 13:58:35 +0000 (+0000) Subject: re PR middle-end/59448 (Code generation doesn't respect C11 address-dependency) X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=8673b6713e9457187cc9ecbefe949fb2393cb057;p=gcc.git re PR middle-end/59448 (Code generation doesn't respect C11 address-dependency) 2015-01-14 Andrew MacLeod PR middle-end/59448 * builtins.c (get_memmodel): Promote consume to acquire always. * testsuite/gcc.dg/atomic-invalid.c: Remove obselete test for illegal consume in an atomic_exchange. From-SVN: r219601 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 43d6a1a0a93..a8dc1d36f74 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,8 @@ +2015-01-14 Andrew MacLeod + + PR middle-end/59448 + * builtins.c (get_memmodel): Promote consume to acquire always. + 2014-01-14 Ilya Tocar PR target/64386 diff --git a/gcc/builtins.c b/gcc/builtins.c index 9280704e043..c8b1940e10a 100644 --- a/gcc/builtins.c +++ b/gcc/builtins.c @@ -5365,6 +5365,11 @@ get_memmodel (tree exp) return MEMMODEL_SEQ_CST; } + /* Workaround for Bugzilla 59448. GCC doesn't track consume properly, so + be conservative and promote consume to acquire. */ + if (val == MEMMODEL_CONSUME) + val = MEMMODEL_ACQUIRE; + return (enum memmodel) val; } diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index d39b2d7814e..3df2a2c7185 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,9 @@ +2015-01-14 Andrew MacLeod + + PR middle-end/59448 + * gcc.dg/atomic-invalid.c: Remove obselete test for illegal consume in + an atomic_exchange. + 2014-01-14 Ilya Tocar PR target/64386 diff --git a/gcc/testsuite/gcc.dg/atomic-invalid.c b/gcc/testsuite/gcc.dg/atomic-invalid.c index 4d040e1d572..6404ae86f5b 100644 --- a/gcc/testsuite/gcc.dg/atomic-invalid.c +++ b/gcc/testsuite/gcc.dg/atomic-invalid.c @@ -17,8 +17,6 @@ main () __atomic_compare_exchange_n (&i, &e, 1, 0, __ATOMIC_SEQ_CST, __ATOMIC_RELEASE); /* { dg-error "invalid failure memory" } */ __atomic_compare_exchange_n (&i, &e, 1, 1, __ATOMIC_SEQ_CST, __ATOMIC_ACQ_REL); /* { dg-error "invalid failure memory" } */ - __atomic_exchange_n (&i, 1, __ATOMIC_CONSUME); /* { dg-error "invalid memory model" } */ - __atomic_load_n (&i, __ATOMIC_RELEASE); /* { dg-error "invalid memory model" } */ __atomic_load_n (&i, __ATOMIC_ACQ_REL); /* { dg-error "invalid memory model" } */