Bug 67523 - ICE with invalid combined simd inside of a template
Summary: ICE with invalid combined simd inside of a template
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: c++ (show other bugs)
Version: 5.2.1
: P3 normal
Target Milestone: 5.3
Assignee: Jakub Jelinek
URL:
Keywords: error-recovery, openmp
Depends on:
Blocks:
 
Reported: 2015-09-09 16:34 UTC by Jakub Jelinek
Modified: 2015-09-10 09:29 UTC (History)
0 users

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed: 2015-09-09 00:00:00


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Jakub Jelinek 2015-09-09 16:34:23 UTC
struct S { int s; };

template <typename T>
void foo (T &x, T &y)
{
#pragma omp for simd
  for (T i = x; i < y; i++)	// { dg-error "used with class iteration variable" }
    ;
#pragma omp parallel for simd
  for (T i = x; i < y; i++)	// { dg-error "used with class iteration variable" }
    ;
#pragma omp target teams distribute parallel for simd
  for (T i = x; i < y; i++)	// { dg-error "used with class iteration variable" }
    ;
#pragma omp target teams distribute simd
  for (T i = x; i < y; i++)	// { dg-error "used with class iteration variable" }
    ;
}

void
bar ()
{
  S x, y;
  foo <S> (x, y);
}

ICEs because during instantiation it is harder to find out the inner stmt has been removed and remove the stmts combined/composited with it.
Comment 1 Jakub Jelinek 2015-09-10 07:36:28 UTC
Author: jakub
Date: Thu Sep 10 07:35:56 2015
New Revision: 227611

URL: https://gcc.gnu.org/viewcvs?rev=227611&root=gcc&view=rev
Log:
	PR c++/67523
	* gimplify.c (gimplify_omp_for): If inner stmt is not found
	for combined loop, assert seen_error () and return GS_ERROR.

	* g++.dg/gomp/pr67523.C: New test.

Added:
    trunk/gcc/testsuite/g++.dg/gomp/pr67523.C
Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/gimplify.c
    trunk/gcc/testsuite/ChangeLog
Comment 2 Jakub Jelinek 2015-09-10 07:42:06 UTC
Author: jakub
Date: Thu Sep 10 07:41:34 2015
New Revision: 227618

URL: https://gcc.gnu.org/viewcvs?rev=227618&root=gcc&view=rev
Log:
	PR c++/67523
	* gimplify.c (gimplify_omp_for): If inner stmt is not found
	for combined loop, assert seen_error () and return GS_ERROR.

	* g++.dg/gomp/pr67523.C: New test.

Added:
    branches/gcc-5-branch/gcc/testsuite/g++.dg/gomp/pr67523.C
Modified:
    branches/gcc-5-branch/gcc/ChangeLog
    branches/gcc-5-branch/gcc/gimplify.c
    branches/gcc-5-branch/gcc/testsuite/ChangeLog
Comment 3 Jakub Jelinek 2015-09-10 09:29:19 UTC
Fixed for 5.3+.