summaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.c-torture/compile/pr38789.c
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/testsuite/gcc.c-torture/compile/pr38789.c')
-rw-r--r--gcc/testsuite/gcc.c-torture/compile/pr38789.c19
1 files changed, 19 insertions, 0 deletions
diff --git a/gcc/testsuite/gcc.c-torture/compile/pr38789.c b/gcc/testsuite/gcc.c-torture/compile/pr38789.c
new file mode 100644
index 000000000..1a26b8055
--- /dev/null
+++ b/gcc/testsuite/gcc.c-torture/compile/pr38789.c
@@ -0,0 +1,19 @@
+/* PR tree-optimization/38789 */
+/* { dg-do compile } */
+
+void
+baz (int v)
+{
+ unsigned a = (v == 1) ? 1 : 2;
+
+ if (__builtin_constant_p (a))
+ asm volatile ("# constant %0" :: "i" (a));
+ else
+ asm volatile ("# register %0" :: "r" (a));
+
+ a = 6;
+ if (__builtin_constant_p (a))
+ asm volatile ("# constant %0" :: "i" (a));
+ else
+ asm volatile ("# register %0" :: "r" (a));
+}