This is the mail archive of the gcc-bugs@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]

[Bug target/35498] New: libgomp/testsuite/libgomp.c/atomic-3.c fails on ppc-linux


/* { dg-do run } */
/* { dg-options "-fopenmp -O2" } */

extern int omp_get_num_threads (void);
extern void abort (void);

short e[64];
int num_threads;
int g;
_Complex double d, f;

__attribute__((noinline)) void
foo (int x, long long y)
{
#pragma omp parallel num_threads (4)
  {
    int i;
    #pragma omp barrier
    for (i = 0; i < 2400; i++)
      {
        if (i == 0)
          num_threads = omp_get_num_threads ();
        #pragma omp atomic
          e[0] += x;
      }
  }
}

int
main (void)
{
  int i;
  foo (3, 3LL);
  if (e[0] != 3 * 2400 * num_threads)
    abort ();
  return 0;
}

as well as atomic-3.c fails on ppc-linux.
In *.optimized dump the atomic operation is:
  D.1288 = (short unsigned int) .omp_data_i->x;
  D.1290 = e[0];

<bb 6>:
  D.1294 = __sync_val_compare_and_swap_2 (&e, D.1290, (short int) ((short
unsigned int) D.1290 + D.1288));
  D.1295 = D.1290;
  D.1290 = D.1294;
  if (D.1294 != D.1295)
    goto <bb 6>;
  else
    goto <bb 7>;
which looks correct.


-- 
           Summary: libgomp/testsuite/libgomp.c/atomic-3.c fails on ppc-
                    linux
           Product: gcc
           Version: 4.3.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: target
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: jakub at gcc dot gnu dot org
GCC target triplet: ppc-linux


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=35498


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