This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [gomp4] reduction bug fix


Hi Cesar!

On Fri, 3 Oct 2014 09:22:52 -0700, Cesar Philippidis <cesar@codesourcery.com> wrote:
> There is a reduction bug [...]

Thanks for looking into this!

> This is a problem because initialize_reduction_data originally expected
> a GIMPLE_BIND at the very beginning of a parallel block.  [...]

Does your patch also fix the issue that Jim saw in his C++ work?

> This patch also includes a runtime test case. I won't apply it to
> gomp-4_0-branch just yet. But I wanted to demonstrate a test case
> nonetheless.

You can add it as a compile test, and I'll toggle to a run test as part
of the merge into our internal development branch.

> Also, note that part of this patch also changes a comment.
> I found some typos in the original comment, so I took the opportunity to
> fix them, I hope.

Sure, and it's also always fine to separately apply such patches under
the obvious rule.

> Is this OK for gomp-4_0-branch?

Yes, with the following addressed:

> --- a/gcc/omp-low.c
> +++ b/gcc/omp-low.c
> @@ -10140,11 +10140,20 @@ process_reduction_data (gimple_seq *body, gimple_seq *in_stmt_seqp,

    [...]/source-gcc/gcc/omp-low.c: In function 'void _ZL22process_reduction_dataPP21gimple_statement_baseS1_S1_P11omp_context.isra.167.constprop.180(gimple_statement_base**, gimple_statement_base**, gimple_statement_base**, gimple)':
    [...]/source-gcc/gcc/omp-low.c:10172:14: warning: 'inner' may be used uninitialized in this function [-Wmaybe-uninitialized]
       gimple_seq inner;
                  ^

> --- /dev/null
> +++ b/libgomp/testsuite/libgomp.oacc-c/collapse-4.c
> @@ -0,0 +1,34 @@
> +/* { dg-do run } */
> +/* { dg-options "-O2 -std=c99" } */
> +
> +#include <string.h>
> +#include <stdlib.h>
> +#include <stdio.h>
> +
> +int
> +main (void)
> +{
> +  int i2, l = 0, r = 0;
> +  int a[3][3][3];
> +  int b[3][3];

A lot of these variables are unused.

> +printf("&a %p\n", &a[0][0][0]);
> +printf("&i2 %p\n", &i2);
> +printf("&l %p\n", &l);
> +printf("&r %p\n", &r);

Please remove <stdio.h> include and the printfs, or at least put those
into DEBUG conditionals.


GrÃÃe,
 Thomas

Attachment: pgpqwSW8gn0Wx.pgp
Description: PGP signature


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]