| 1 |
// { dg-do link } |
| 2 |
|
| 3 |
// Actually not needed: -fipa-cp is default with -O2: |
| 4 |
// { dg-additional-options "-O2 -fipa-cp" } |
| 5 |
|
| 6 |
// The code failed because 'std::endl' becoḿes implicitly 'declare target' |
| 7 |
// but not the 'widen' function it calls. While the linker had no issues |
| 8 |
// (endl is never called, either because it is inlined or optimized away), |
| 9 |
// the IPA-CP (enabled by -O2 and higher) failed as the definition for |
| 10 |
// 'widen' did not exist on the offload side. |
| 11 |
|
| 12 |
#include <iostream> |
| 13 |
|
| 14 |
void func (int m) |
| 15 |
{ |
| 16 |
if (m < 0) |
| 17 |
std::cout << "should not happen" << std::endl; |
| 18 |
} |
| 19 |
|
| 20 |
|
| 21 |
int main() |
| 22 |
{ |
| 23 |
#pragma omp target |
| 24 |
func (1); |
| 25 |
} |