From a76989dc7c9236214856db196da88a739f0e7baa Mon Sep 17 00:00:00 2001 From: Marek Polacek Date: Thu, 18 Aug 2016 16:38:49 +0000 Subject: re PR c/71514 (ICE on C11 code with atomic exchange at -O1 and above on x86_64-linux-gnu: in copy_reference_ops_from_ref, at tree-ssa-sccvn.c:879) PR c/71514 * c-common.c (get_atomic_generic_size): Disallow pointer-to-function and pointer-to-VLA. * gcc.dg/pr71514.c: New test. From-SVN: r239581 --- gcc/c-family/c-common.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'gcc/c-family/c-common.c') diff --git a/gcc/c-family/c-common.c b/gcc/c-family/c-common.c index d413146..22e3844 100644 --- a/gcc/c-family/c-common.c +++ b/gcc/c-family/c-common.c @@ -11081,6 +11081,20 @@ get_atomic_generic_size (location_t loc, tree function, function); return 0; } + else if (TYPE_SIZE_UNIT (TREE_TYPE (type)) + && TREE_CODE ((TYPE_SIZE_UNIT (TREE_TYPE (type)))) + != INTEGER_CST) + { + error_at (loc, "argument %d of %qE must be a pointer to a constant " + "size type", x + 1, function); + return 0; + } + else if (FUNCTION_POINTER_TYPE_P (type)) + { + error_at (loc, "argument %d of %qE must not be a pointer to a " + "function", x + 1, function); + return 0; + } tree type_size = TYPE_SIZE_UNIT (TREE_TYPE (type)); size = type_size ? tree_to_uhwi (type_size) : 0; if (size != size_0) -- cgit v1.1