Patchwork Don't segv on __atomic_store (PR c/61553)

login
register
mail settings
Submitter Marek Polacek
Date June 23, 2014, 6:21 p.m.
Message ID <20140623182138.GL14420@redhat.com>
Download mbox | patch
Permalink /patch/363086/
State New
Headers show

Comments

Marek Polacek - June 23, 2014, 6:21 p.m.
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  <polacek@redhat.com>

	PR c/61553
	* c-c++-common/pr61553.c (foo): Add dg-error.


	Marek
Matthias Klose - Nov. 5, 2014, 11:49 p.m.
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  <polacek@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

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" } */
 }