diff options
author | Marek Polacek <polacek@redhat.com> | 2014-06-23 16:57:48 +0000 |
---|---|---|
committer | Marek Polacek <mpolacek@gcc.gnu.org> | 2014-06-23 16:57:48 +0000 |
commit | 7b56b2f848d36fc3c5445f74c38720bd93e5f9e2 (patch) | |
tree | abc516d7f628421a382ce30a91fe462e77aabc42 /gcc | |
parent | e5d8bd8c7734c24c23621db9563f7aae772dee97 (diff) | |
download | gcc-7b56b2f848d36fc3c5445f74c38720bd93e5f9e2.zip gcc-7b56b2f848d36fc3c5445f74c38720bd93e5f9e2.tar.gz gcc-7b56b2f848d36fc3c5445f74c38720bd93e5f9e2.tar.bz2 |
re PR c/61553 (__atomic_store with non-pointer arg ICE)
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.
Co-Authored-By: Andrew MacLeod <amacleod@redhat.com>
From-SVN: r211905
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/c-family/ChangeLog | 7 | ||||
-rw-r--r-- | gcc/c-family/c-common.c | 3 | ||||
-rw-r--r-- | gcc/testsuite/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/testsuite/c-c++-common/pr61553.c | 8 |
4 files changed, 22 insertions, 1 deletions
diff --git a/gcc/c-family/ChangeLog b/gcc/c-family/ChangeLog index e37aa46d..0b23bb3 100644 --- a/gcc/c-family/ChangeLog +++ b/gcc/c-family/ChangeLog @@ -1,3 +1,10 @@ +2014-06-23 Marek Polacek <polacek@redhat.com> + Andrew MacLeod <amacleod@redhat.com> + + 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 <polacek@redhat.com> * 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 077263e..087f036 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 ad97d0b..b6d09b3 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2014-06-23 Marek Polacek <polacek@redhat.com> + + PR c/61553 + * c-c++-common/pr61553.c: New test. + 2014-06-23 Richard Biener <rguenther@suse.de> * 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 0000000..fa97e94 --- /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); +} |