}
}
+/* Verify the partitioning of NODE. */
+
+static inline void
+verify_node_partition (symtab_node *node)
+{
+ if (flag_ltrans)
+ return;
+
+#ifdef ACCEL_COMPILER
+ if (node->in_other_partition)
+ {
+ if (TREE_CODE (node->decl) == FUNCTION_DECL)
+ error_at (DECL_SOURCE_LOCATION (node->decl),
+ "function %qs has been referenced in offloaded code but"
+ " hasn%'t been marked to be included in the offloaded code",
+ node->name ());
+ else if (VAR_P (node->decl))
+ error_at (DECL_SOURCE_LOCATION (node->decl),
+ "variable %qs has been referenced in offloaded code but"
+ " hasn%'t been marked to be included in the offloaded code",
+ node->name ());
+ else
+ gcc_unreachable ();
+ }
+#else
+ gcc_assert (!node->in_other_partition
+ && !node->used_from_other_partition);
+#endif
+}
+
/* Overwrite the information in NODE based on FILE_DATA, TAG, FLAGS,
STACK_SIZE, SELF_TIME and SELF_SIZE. This is called either to initialize
NODE or to replace the values in it, for instance because the first
node->resolution = bp_unpack_enum (bp, ld_plugin_symbol_resolution,
LDPR_NUM_KNOWN);
node->split_part = bp_unpack_value (bp, 1);
- gcc_assert (flag_ltrans
- || (!node->in_other_partition
- && !node->used_from_other_partition));
+ verify_node_partition (node);
}
/* Return string alias is alias of. */
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));
-
+ verify_node_partition (node);
return node;
}
+2018-12-14 Tom de Vries <tdevries@suse.de>
+
+ * testsuite/libgomp.c-c++-common/function-not-offloaded-aux.c: New test.
+ * testsuite/libgomp.c-c++-common/function-not-offloaded.c: New test.
+ * testsuite/libgomp.c-c++-common/variable-not-offloaded.c: New test.
+ * testsuite/libgomp.oacc-c-c++-common/function-not-offloaded.c: New test.
+ * testsuite/libgomp.oacc-c-c++-common/variable-not-offloaded.c: New test.
+
2018-12-13 Tom de Vries <tdevries@suse.de>
* affinity-fmt.c (gomp_print_string): New function, factored out of ...
--- /dev/null
+/* { dg-do link } */
+/* { dg-excess-errors "lto1, mkoffload and lto-wrapper fatal errors" { target offload_device_nonshared_as } } */
+
+int var; /* { dg-error "variable 'var' has been referenced in offloaded code but hasn't been marked to be included in the offloaded code" "" { target offload_device_nonshared_as } } */
+
+#pragma omp declare target
+void __attribute__((noinline, noclone))
+foo (void)
+{
+ var++;
+}
+#pragma omp end declare target
+
+int
+main ()
+{
+#pragma omp target
+ foo ();
+}