]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
PR c/61553
authormpolacek <mpolacek@138bc75d-0d04-0410-961f-82ee72b054a4>
Mon, 23 Jun 2014 16:57:48 +0000 (16:57 +0000)
committermpolacek <mpolacek@138bc75d-0d04-0410-961f-82ee72b054a4>
Mon, 23 Jun 2014 16:57:48 +0000 (16:57 +0000)
* 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

gcc/c-family/ChangeLog
gcc/c-family/c-common.c
gcc/testsuite/ChangeLog
gcc/testsuite/c-c++-common/pr61553.c [new file with mode: 0644]

index e37aa46d856b23382b0fa0f2c15b0dbd2c8b2e98..0b23bb38e12219808c299ffc0f9d9063152672cc 100644 (file)
@@ -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".
index 077263e1de5881d82f9a0d25ff581954952fd62e..087f036c34a95d3cd160bd242358b9c1f8474936 100644 (file)
@@ -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,
index ad97d0b17d0239229c19d0b9ab70d288c65321d7..b6d09b366e4e91077b5af54b07d9e72ff7825e0f 100644 (file)
@@ -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 (file)
index 0000000..fa97e94
--- /dev/null
@@ -0,0 +1,8 @@
+/* PR c/61553 */
+/* { dg-do compile } */
+
+void
+foo (char *s)
+{
+  __atomic_store (s, (void *) 0, __ATOMIC_SEQ_CST);
+}