aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.dg/builtin-strstr.c
diff options
context:
space:
mode:
authorJames E Wilson <wilson@specifixinc.com>2005-11-18 18:25:25 -0800
committerJim Wilson <wilson@gcc.gnu.org>2005-11-18 18:25:25 -0800
commit817f9ef2e52bbe4568264487acfa86c5bb2882d4 (patch)
tree875aa41b0e0cf9f95daa844c1be7324c0213984a /gcc/testsuite/gcc.dg/builtin-strstr.c
parent7b767e311d47363e5f0f688faa121fe28798a393 (diff)
downloadgcc-817f9ef2e52bbe4568264487acfa86c5bb2882d4.zip
gcc-817f9ef2e52bbe4568264487acfa86c5bb2882d4.tar.gz
gcc-817f9ef2e52bbe4568264487acfa86c5bb2882d4.tar.bz2
Fix spurious warning for strstr (s, "").
* builtins.c (fold_builtin_strstr): Pass s1 through fold_convert before returning it. * gcc.dg/builtin-strstr.c: New. From-SVN: r107206
Diffstat (limited to 'gcc/testsuite/gcc.dg/builtin-strstr.c')
-rw-r--r--gcc/testsuite/gcc.dg/builtin-strstr.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/gcc/testsuite/gcc.dg/builtin-strstr.c b/gcc/testsuite/gcc.dg/builtin-strstr.c
new file mode 100644
index 0000000..b8201f4
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/builtin-strstr.c
@@ -0,0 +1,8 @@
+/* The strstr call is expanded to just "s", which should not result in a
+ warning about discarding qualifiers in an assignment. */
+/* { dg-do compile } */
+extern char * strstr (const char *s1, const char * s2);
+void foo(const char *s){
+ char * cp;
+ cp = strstr(s, "");
+}