diff options
author | Jakub Jelinek <jakub@redhat.com> | 2017-09-12 13:49:29 +0200 |
---|---|---|
committer | Jakub Jelinek <jakub@gcc.gnu.org> | 2017-09-12 13:49:29 +0200 |
commit | ec33aebb1cd640f0751614ccd1b759d0f41ffb2f (patch) | |
tree | f280f7a02ce7a04a489492de1b7806bcb2263c28 /gcc/c-family | |
parent | dee6fc2b43d2fc004ffe65a0e030fc74facb7c64 (diff) | |
download | gcc-ec33aebb1cd640f0751614ccd1b759d0f41ffb2f.zip gcc-ec33aebb1cd640f0751614ccd1b759d0f41ffb2f.tar.gz gcc-ec33aebb1cd640f0751614ccd1b759d0f41ffb2f.tar.bz2 |
re PR target/82112 (internal compiler error: in fold_convert_loc, at fold-const.c:2262)
PR target/82112
* c-common.c (sync_resolve_size): Instead of c_dialect_cxx ()
assertion check that in the condition.
(get_atomic_generic_size): Likewise. Before testing if parameter
has pointer type, if it has array type, call for C++
default_conversion to perform array-to-pointer conversion.
* c-c++-common/pr82112.c: New test.
* gcc.dg/pr82112.c: New test.
From-SVN: r252003
Diffstat (limited to 'gcc/c-family')
-rw-r--r-- | gcc/c-family/c-common.c | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/gcc/c-family/c-common.c b/gcc/c-family/c-common.c index d959dbc..af50cc7 100644 --- a/gcc/c-family/c-common.c +++ b/gcc/c-family/c-common.c @@ -6478,10 +6478,9 @@ sync_resolve_size (tree function, vec<tree, va_gc> *params, bool fetch) } argtype = type = TREE_TYPE ((*params)[0]); - if (TREE_CODE (type) == ARRAY_TYPE) + if (TREE_CODE (type) == ARRAY_TYPE && c_dialect_cxx ()) { /* Force array-to-pointer decay for C++. */ - gcc_assert (c_dialect_cxx()); (*params)[0] = default_conversion ((*params)[0]); type = TREE_TYPE ((*params)[0]); } @@ -6646,10 +6645,9 @@ get_atomic_generic_size (location_t loc, tree function, /* Get type of first parameter, and determine its size. */ type_0 = TREE_TYPE ((*params)[0]); - if (TREE_CODE (type_0) == ARRAY_TYPE) + if (TREE_CODE (type_0) == ARRAY_TYPE && c_dialect_cxx ()) { /* Force array-to-pointer decay for C++. */ - gcc_assert (c_dialect_cxx()); (*params)[0] = default_conversion ((*params)[0]); type_0 = TREE_TYPE ((*params)[0]); } @@ -6688,6 +6686,12 @@ get_atomic_generic_size (location_t loc, tree function, /* __atomic_compare_exchange has a bool in the 4th position, skip it. */ if (n_param == 6 && x == 3) continue; + if (TREE_CODE (type) == ARRAY_TYPE && c_dialect_cxx ()) + { + /* Force array-to-pointer decay for C++. */ + (*params)[x] = default_conversion ((*params)[x]); + type = TREE_TYPE ((*params)[x]); + } if (!POINTER_TYPE_P (type)) { error_at (loc, "argument %d of %qE must be a pointer type", x + 1, |