Quuxplusone / LLVMBugzillaTest

0 stars 0 forks source link

[OPENMP] canonical loop rejected when comparison has implicit conversions or destruction #24120

Closed Quuxplusone closed 9 years ago

Quuxplusone commented 9 years ago
Bugzilla Link PR24121
Status RESOLVED FIXED
Importance P normal
Reported by hstong@ca.ibm.com
Reported on 2015-07-14 13:01:58 -0700
Last modified on 2015-07-15 23:20:44 -0700
Version trunk
Hardware All All
CC a.bataev@hotmail.com, dgregor@apple.com, hfinkel@anl.gov, howarth.mailing.lists@gmail.com, llvm-bugs@lists.llvm.org
Fixed by commit(s)
Attachments openmpCmpOp.cc (1522 bytes, application/octet-stream)
Blocks
Blocked by
See also
Created attachment 14587
Test canonical loop with custom random access iterators

When a user-defined random access iterator is used with the OpenMP loop
construct, Clang rejects canonical loops if the comparison operation entails
implicit conversions or the creation of temporaries requiring non-trivial
destruction.

Source is attached; various cases are included under macro control.

CASE_0: this works; it includes an namespace operator< for the iterator type
CASE_1: this fails; calling the same operator< now involves non-trivial temp
destruction
CASE_2: this fails; the operator< returns a class object which is contextually
convertible to bool
CASE_3: this fails; a built-in operator< is used, requiring implicit conversion
of the operands

### COMPILER INVOCATION:
clang++ -fopenmp=libomp -std=c++11 openmpCmpOp.cc -DCASE_0 -c
clang++ -fopenmp=libomp -std=c++11 openmpCmpOp.cc -DCASE_1 -c
clang++ -fopenmp=libomp -std=c++11 openmpCmpOp.cc -DCASE_2 -c
clang++ -fopenmp=libomp -std=c++11 openmpCmpOp.cc -DCASE_3 -c

### OUTPUT (failing cases):
openmpCmpOp.cc:62:29: error: condition of OpenMP for loop must be a relational
comparison ('<', '<=', '>', or '>=') of loop variable 'it'
  for (It<char> it = begin; it < end; ++it) {
                            ^~~~~~~~
1 error generated.

### EXPECTED OUTPUT:
(Compiles successfully).

### COMPILER VERSION INFO:
clang version 3.7.0 (trunk)
Target: powerpc64le-unknown-linux-gnu
Thread model: posix
Found candidate GCC installation: /usr/lib/gcc/ppc64le-redhat-linux/4.8.2
Found candidate GCC installation: /usr/lib/gcc/ppc64le-redhat-linux/4.8.3
Selected GCC installation: /usr/lib/gcc/ppc64le-redhat-linux/4.8.3
Candidate multilib: .;@m64
Selected multilib: .;@m64
Quuxplusone commented 9 years ago

Attached openmpCmpOp.cc (1522 bytes, application/octet-stream): Test canonical loop with custom random access iterators

Quuxplusone commented 9 years ago

Committed revision 242285.

Quuxplusone commented 9 years ago

Shouldn't the fix from r242285 also go into 3.7.0 branch?

Quuxplusone commented 9 years ago
It there a reason why the copy constructor cannot have default arguments? e.g.:
  It(const It &o, int = 0) noexcept : p(o.p) {}
  It(It &&o, int = 0) noexcept : p(o.p) {}

or why the copy cannot be done by a converting template constructor? e.g.:
  template <typename U> It(U &&o) noexcept : p(o.p) {}
  It(const It &) noexcept = default;
  It(It &&) noexcept = default;
Quuxplusone commented 9 years ago
> It there a reason why the copy constructor cannot have default arguments?
e.g.:
>  It(const It &o, int = 0) noexcept : p(o.p) {}
>  It(It &&o, int = 0) noexcept : p(o.p) {}
>
> or why the copy cannot be done by a converting template constructor? e.g.:
>  template <typename U> It(U &&o) noexcept : p(o.p) {}
>  It(const It &) noexcept = default;
>  It(It &&) noexcept = default;

Fixed in revision 242382.