re PR c/81231 (ICE with invalid argument to __atomic_*)

PR c/81231
	* c-common.c (sync_resolve_size): Give error for pointers to incomplete
	types.

	* gcc.dg/atomic-pr81231.c: New test.

From-SVN: r249963
This commit is contained in:
Marek Polacek 2017-07-04 12:17:22 +00:00 committed by Marek Polacek
parent f0622a50ee
commit efbf55b01c
4 changed files with 26 additions and 0 deletions

View file

@ -1,3 +1,9 @@
2017-07-04 Marek Polacek <polacek@redhat.com>
PR c/81231
* c-common.c (sync_resolve_size): Give error for pointers to incomplete
types.
2017-07-04 Marek Polacek <polacek@redhat.com>
* c-warn.c (warn_if_unused_value): Remove WITH_CLEANUP_EXPR handling.

View file

@ -6485,6 +6485,9 @@ sync_resolve_size (tree function, vec<tree, va_gc> *params, bool fetch)
if (!INTEGRAL_TYPE_P (type) && !POINTER_TYPE_P (type))
goto incompatible;
if (!COMPLETE_TYPE_P (type))
goto incompatible;
if (fetch && TREE_CODE (type) == BOOLEAN_TYPE)
goto incompatible;

View file

@ -1,3 +1,8 @@
2017-07-04 Marek Polacek <polacek@redhat.com>
PR c/81231
* gcc.dg/atomic-pr81231.c: New test.
2017-07-04 Richard Sandiford <richard.sandiford@linaro.org>
PR tree-optimization/81292

View file

@ -0,0 +1,12 @@
/* PR c/81231 */
/* { dg-do compile } */
/* { dg-options "" } */
enum E;
void
foo (void)
{
__atomic_load_n ((enum E *) 0, 0); /* { dg-error "incompatible" } */
__atomic_load_n ((enum X *) 0, 0); /* { dg-error "incompatible" } */
}