This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[nvptx, committed, PR80855] Add "sorry, target cannot support label values" for nvptx


Hi,

this patch fixes PR80855, an nvptx target bug where we generate invalid ptx assembly when encountering label values.

Fixed by emitting "a sorry, unimplemented" message instead.

Tested on nvptx target.

Committed as obvious.

Thanks,
- Tom

Add "sorry, target cannot support label values" for nvptx

2017-06-09  Tom de Vries  <tom@codesourcery.com>

	PR target/80855
	* config/nvptx/nvptx.md (define_expand "mov<QHSDISDFM>"): Error out with
	"target cannot support label values" when encountering LABEL_REF.

	* gcc.target/nvptx/label-values.c: New test.

---
 gcc/config/nvptx/nvptx.md                     |  3 +++
 gcc/testsuite/gcc.target/nvptx/label-values.c | 14 ++++++++++++++
 4 files changed, 28 insertions(+)

diff --git a/gcc/config/nvptx/nvptx.md b/gcc/config/nvptx/nvptx.md
index f2ed63b..f2b0905 100644
--- a/gcc/config/nvptx/nvptx.md
+++ b/gcc/config/nvptx/nvptx.md
@@ -254,6 +254,9 @@
       emit_move_insn (operands[0], tmp);
       DONE;
     }
+
+  if (GET_CODE (operands[1]) == LABEL_REF)
+    sorry ("target cannot support label values");
 })
 
 (define_insn "zero_extendqihi2"
diff --git a/gcc/testsuite/gcc.target/nvptx/label-values.c b/gcc/testsuite/gcc.target/nvptx/label-values.c
new file mode 100644
index 0000000..350510e
--- /dev/null
+++ b/gcc/testsuite/gcc.target/nvptx/label-values.c
@@ -0,0 +1,14 @@
+/* { dg-do compile } */
+/* { dg-additional-options "-Wno-pedantic" } */
+
+int
+main (void)
+{
+  goto L2;
+ L1:
+  return 0;
+ L2:
+  {
+    void *ptr = &&L1; /* { dg-message "sorry, unimplemented: target cannot support label values" "" } */
+  }
+}

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]