-
Notifications
You must be signed in to change notification settings - Fork 3
Open
Labels
bugSomething isn't workingSomething isn't workingcompilerCompiler related issueCompiler related issue
Description
The following program fails to compile with an internal compiler error:
#include <stdio.h>
#include <stdlib.h>
#include "../common/common.h"
#include "../common/sync.h"
int main()
{
double sleft[2] __attribute__((stream));
void* sleft_ref = malloc(2*sizeof(void*));
memcpy(sleft_ref, sleft, 2*sizeof(void*));
double scenter[2] __attribute__((stream));
void* scenter_ref = malloc(2*sizeof(void*));
memcpy(scenter_ref, scenter, 2*sizeof(void*));
double sright[2] __attribute__((stream));
void* sright_ref = malloc(2*sizeof(void*));
memcpy(sright_ref, sright, 2*sizeof(void*));
double input[12] = {1,1,1,1,1,1,1,1,1,1,1,1};
double* input_ref = input;
double output[12];
double* output_ref = output;
for(int id = 0; id < 2; id++)
{
double left_out[1];
double center_out[5];
double right_out[1];
#pragma omp task output(sleft_ref[id] << left_out[1], \
scenter_ref[id] << center_out[5], \
sright_ref[id] << right_out[1])
{
left_out[0] = input_ref[id * 5];
for(int i = 0; i < 5; i++)
center_out[i] = input_ref[id * 5 + i + 1];
right_out[0] = input_ref[id * 5 + 6];
}
}
for(int id = 0; id < 2; id++)
{
double left_in[1];
double center_in[5];
double right_in[1];
#pragma omp task input(sleft_ref[id] >> left_in[1], \
scenter_ref[id] >> center_in[5], \
sright_ref[id] >> right_in[1])
{
output_ref[id * 5 + 1] = (left_in[0] + center_in[0] + center_in[1]) / 3.0;
for(int i = 1; i < 4; i++)
output_ref[id * 5 + i + 1] = (center_in[i - 1] + center_in[i] + center_in[i + 1]) / 3.0;
output_ref[id * 5 + 5] = (right_in[0] + center_in[3] + center_in[4]) / 3.0;
}
}
#pragma omp taskwait
for(int i = 0; i < 10; i++)
printf("%lf ", output[i + 1]);
printf("\n");
}The following error is generated:
during GIMPLE pass: cddce
stream_simple.c:69:1: internal compiler error: in propagate_necessity, at tree-ssa-dce.c:902
69 | }
| ^
0xb648ce propagate_necessity
../../gcc/tree-ssa-dce.c:902
0xb648ce perform_tree_ssa_dce
../../gcc/tree-ssa-dce.c:1592
The problem does not appear when stream references are declared outside the main function:
void* sleft_ref;
void* scenter_ref;
void* sright_ref;
int main()
{
double sleft[2] __attribute__((stream));
sleft_ref = malloc(2*sizeof(void*));
memcpy(sleft_ref, sleft, 2*sizeof(void*));
double scenter[2] __attribute__((stream));
scenter_ref = malloc(2*sizeof(void*));
memcpy(scenter_ref, scenter, 2*sizeof(void*));
double sright[2] __attribute__((stream));
sright_ref = malloc(2*sizeof(void*));
memcpy(sright_ref, sright, 2*sizeof(void*));Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't workingcompilerCompiler related issueCompiler related issue