diff mbox

[gomp4] teach the lto driver to error for missing decls

Message ID 56903A2B.9060906@codesourcery.com
State New
Headers show

Commit Message

Cesar Philippidis Jan. 8, 2016, 10:37 p.m. UTC
In openacc there are situations where a user may fail to mark a variable
or function as offloadable (either using declare or routine). This patch
makes the lto wrapper reduce the missing decl assertion to an error.

I've applied this patch to gomp-4_0-branch.

Cesar

Comments

Bernd Schmidt Jan. 11, 2016, 3:34 p.m. UTC | #1
On 01/08/2016 11:37 PM, Cesar Philippidis wrote:
> In openacc there are situations where a user may fail to mark a variable
> or function as offloadable (either using declare or routine). This patch
> makes the lto wrapper reduce the missing decl assertion to an error.

Hmm, it might be good to have a testcase?


Bernd
Cesar Philippidis Jan. 11, 2016, 3:36 p.m. UTC | #2
On 01/11/2016 07:34 AM, Bernd Schmidt wrote:
> On 01/08/2016 11:37 PM, Cesar Philippidis wrote:
>> In openacc there are situations where a user may fail to mark a variable
>> or function as offloadable (either using declare or routine). This patch
>> makes the lto wrapper reduce the missing decl assertion to an error.
> 
> Hmm, it might be good to have a testcase?

I'm not sure how to test it though. The only reproduce this problem
using an offloaded compiler. Maybe I could add a libgomp test and expect
it to fail.

Cesar
diff mbox

Patch

2016-01-08  Cesar Philippidis  <cesar@codesourcery.com>

	gcc/
	* lto-cgraph.c (input_varpool_node): Reduce the assert for
	missing variables to an error.


diff --git a/gcc/lto-cgraph.c b/gcc/lto-cgraph.c
index c318aa4..eadf128 100644
--- a/gcc/lto-cgraph.c
+++ b/gcc/lto-cgraph.c
@@ -1422,9 +1422,11 @@  input_varpool_node (struct lto_file_decl_data *file_data,
     node->set_section_for_node (section);
   node->resolution = streamer_read_enum (ib, ld_plugin_symbol_resolution,
 					        LDPR_NUM_KNOWN);
-  gcc_assert (flag_ltrans
-	      || (!node->in_other_partition
-		  && !node->used_from_other_partition));
+
+  int success = flag_ltrans || (!node->in_other_partition
+				&& !node->used_from_other_partition);
+  if (!success)
+    error ("Missing %<%s%>", node->name ());
 
   return node;
 }