Re: [PATCH] Don't segv on __atomic_store (PR c/61553)
is this ok to backport to 4.9? testsuite passes without regressions with this patch on the 4.9 branch. Matthias Am 23.06.2014 um 20:21 schrieb Marek Polacek: On Mon, Jun 23, 2014 at 04:39:55PM +0200, Marek Polacek wrote: --- gcc/testsuite/c-c++-common/pr61553.c +++ 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); Oops, dg-error disappeared from the final patch. I'm fixing it with the following. 2014-06-23 Marek Polacek pola...@redhat.com PR c/61553 * c-c++-common/pr61553.c (foo): Add dg-error. diff --git gcc/testsuite/c-c++-common/pr61553.c gcc/testsuite/c-c++-common/pr61553.c index fa97e94..8a3b699 100644 --- gcc/testsuite/c-c++-common/pr61553.c +++ gcc/testsuite/c-c++-common/pr61553.c @@ -4,5 +4,5 @@ void foo (char *s) { - __atomic_store (s, (void *) 0, __ATOMIC_SEQ_CST); + __atomic_store (s, (void *) 0, __ATOMIC_SEQ_CST); /* { dg-error size mismatch } */ } Marek
[PATCH] Don't segv on __atomic_store (PR c/61553)
We ICEd on the following testcase since the void type has a NULL TYPE_SIZE_UNIT. I took Andrew's patch from gcc@ ML and added a testcase. Regtested/bootstrapped on x86_64-linux, ok for trunk? 2014-06-23 Marek Polacek pola...@redhat.com Andrew MacLeod amacl...@redhat.com 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. diff --git gcc/c-family/c-common.c gcc/c-family/c-common.c index 077263e..087f036 100644 --- gcc/c-family/c-common.c +++ 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 gcc/testsuite/c-c++-common/pr61553.c gcc/testsuite/c-c++-common/pr61553.c index e69de29..fa97e94 100644 --- gcc/testsuite/c-c++-common/pr61553.c +++ 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); +} Marek
Re: [PATCH] Don't segv on __atomic_store (PR c/61553)
On Mon, 23 Jun 2014, Marek Polacek wrote: We ICEd on the following testcase since the void type has a NULL TYPE_SIZE_UNIT. I took Andrew's patch from gcc@ ML and added a testcase. Regtested/bootstrapped on x86_64-linux, ok for trunk? 2014-06-23 Marek Polacek pola...@redhat.com Andrew MacLeod amacl...@redhat.com 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. OK. -- Joseph S. Myers jos...@codesourcery.com
Re: [PATCH] Don't segv on __atomic_store (PR c/61553)
On Mon, Jun 23, 2014 at 04:39:55PM +0200, Marek Polacek wrote: --- gcc/testsuite/c-c++-common/pr61553.c +++ 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); Oops, dg-error disappeared from the final patch. I'm fixing it with the following. 2014-06-23 Marek Polacek pola...@redhat.com PR c/61553 * c-c++-common/pr61553.c (foo): Add dg-error. diff --git gcc/testsuite/c-c++-common/pr61553.c gcc/testsuite/c-c++-common/pr61553.c index fa97e94..8a3b699 100644 --- gcc/testsuite/c-c++-common/pr61553.c +++ gcc/testsuite/c-c++-common/pr61553.c @@ -4,5 +4,5 @@ void foo (char *s) { - __atomic_store (s, (void *) 0, __ATOMIC_SEQ_CST); + __atomic_store (s, (void *) 0, __ATOMIC_SEQ_CST); /* { dg-error size mismatch } */ } Marek