From: mpolacek Date: Mon, 23 Jun 2014 16:57:48 +0000 (+0000) Subject: PR c/61553 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=1f6be080fc320950598c93235df3225fb68043ea;p=thirdparty%2Fgcc.git PR c/61553 * c-common.c (get_atomic_generic_size): Don't segfault if the type doesn't have a size. * c-c++-common/pr61553.c: New test. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@211905 138bc75d-0d04-0410-961f-82ee72b054a4 --- diff --git a/gcc/c-family/ChangeLog b/gcc/c-family/ChangeLog index e37aa46d856b..0b23bb38e122 100644 --- a/gcc/c-family/ChangeLog +++ b/gcc/c-family/ChangeLog @@ -1,3 +1,10 @@ +2014-06-23 Marek Polacek + Andrew MacLeod + + PR c/61553 + * c-common.c (get_atomic_generic_size): Don't segfault if the + type doesn't have a size. + 2014-06-20 Marek Polacek * c-gimplify.c: Include "c-ubsan.h" and "pointer-set.h". diff --git a/gcc/c-family/c-common.c b/gcc/c-family/c-common.c index 077263e1de58..087f036c34a9 100644 --- a/gcc/c-family/c-common.c +++ b/gcc/c-family/c-common.c @@ -10471,7 +10471,8 @@ get_atomic_generic_size (location_t loc, tree function, function); return 0; } - size = tree_to_uhwi (TYPE_SIZE_UNIT (TREE_TYPE (type))); + tree type_size = TYPE_SIZE_UNIT (TREE_TYPE (type)); + size = type_size ? tree_to_uhwi (type_size) : 0; if (size != size_0) { error_at (loc, "size mismatch in argument %d of %qE", x + 1, diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index ad97d0b17d02..b6d09b366e4e 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2014-06-23 Marek Polacek + + PR c/61553 + * c-c++-common/pr61553.c: New test. + 2014-06-23 Richard Biener * g++.dg/vect/slp-pr50413.cc: Scan and cleanup appropriate SLP dumps. diff --git a/gcc/testsuite/c-c++-common/pr61553.c b/gcc/testsuite/c-c++-common/pr61553.c new file mode 100644 index 000000000000..fa97e94b74c7 --- /dev/null +++ b/gcc/testsuite/c-c++-common/pr61553.c @@ -0,0 +1,8 @@ +/* PR c/61553 */ +/* { dg-do compile } */ + +void +foo (char *s) +{ + __atomic_store (s, (void *) 0, __ATOMIC_SEQ_CST); +}