re PR c++/35652 (offset warning should be given in the front-end)
authorSimon Baldwin <simonb@google.com>
Sat, 26 Apr 2008 16:59:38 +0000 (16:59 +0000)
committerSimon Baldwin <simonb@gcc.gnu.org>
Sat, 26 Apr 2008 16:59:38 +0000 (16:59 +0000)
       PR c/35652
       * builtins.c (c_strlen): Suppressed multiple warnings that can occur
       with propagated string constants.

From-SVN: r134714

gcc/ChangeLog
gcc/builtins.c

index 843a2e232df43cb16ef17e6c656dfd833ae4f4a0..6453c50335509679e103d2f3ea10f04a35c79d8d 100644 (file)
@@ -1,3 +1,9 @@
+2008-04-26  Simon Baldwin <simonb@google.com>
+
+       PR c/35652
+       * builtins.c (c_strlen): Suppressed multiple warnings that can occur
+       with propagated string constants.
+
 2008-04-26  Uros Bizjak  <ubizjak@gmail.com>
 
        * config/i386/i386.md (fix_trunc<mode>_i387_fisttp_with_temp): Use 'X'
index 765294b1be3328b2d082d05c3e16d51e095ec6a5..321032dace026b09448c4724479ea3cd74c4ce61 100644 (file)
@@ -447,7 +447,12 @@ c_strlen (tree src, int only_value)
      runtime.  */
   if (offset < 0 || offset > max)
     {
-      warning (0, "offset outside bounds of constant string");
+     /* Suppress multiple warnings for propagated constant strings.  */
+      if (! TREE_NO_WARNING (src))
+        {
+          warning (0, "offset outside bounds of constant string");
+          TREE_NO_WARNING (src) = 1;
+        }
       return NULL_TREE;
     }