]> git.ipfire.org Git - thirdparty/gcc.git/blobdiff - gcc/testsuite/gcc.target/bpf/core-options-1.c
bpf: avoid issues with CO-RE and -gtoggle
[thirdparty/gcc.git] / gcc / testsuite / gcc.target / bpf / core-options-1.c
diff --git a/gcc/testsuite/gcc.target/bpf/core-options-1.c b/gcc/testsuite/gcc.target/bpf/core-options-1.c
new file mode 100644 (file)
index 0000000..7d8c677
--- /dev/null
@@ -0,0 +1,15 @@
+/* -gbtf for the BPF target should enable CO-RE support automatically.  */
+/* { dg-do compile } */
+/* { dg-options "-gbtf" } */
+
+struct A {
+  int x;
+  int y;
+  char c;
+};
+
+int
+foo (struct A *a) {
+  int y = __builtin_preserve_access_index (a->y);
+  return y;
+}