public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "manu at gcc dot gnu dot org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug middle-end/35903] false Warray-bounds warning when passing quoted string to function strcmp(arg,"no");
Date: Sat, 20 Feb 2010 00:19:00 -0000	[thread overview]
Message-ID: <20100220001914.5572.qmail@sourceware.org> (raw)
In-Reply-To: <bug-35903-12775@http.gcc.gnu.org/bugzilla/>



------- Comment #10 from manu at gcc dot gnu dot org  2010-02-20 00:19 -------
Reduced testcase:

extern int strlen (__const char *__s);
int echo (int);
int main(int argc, char **argv)
{
  echo (({ int __s1_len, __s2_len;
  (__builtin_constant_p (argv[0]) && __builtin_constant_p ("AA") &&
   (__s1_len = strlen (argv[0]), __s2_len = strlen ("AA"),
    (!((int)(const void *)((argv[0]) + 1) - (int)(const void *)(argv[0]) == 1)
     || __s1_len >= 4)
    &&
    (!((int)(const void *)(("AA") + 1) - (int)(const void *)("AA") == 1)
     || __s2_len >= 4))
   ? 1
   : (__builtin_constant_p (argv[0])
      && ((int)(const void *)((argv[0]) + 1) - (int)(const void *)(argv[0]) ==
1)
      && (__s1_len = strlen (argv[0]), __s1_len < 4)
      ? 1
      : (__builtin_constant_p ("AA") && ((int)(const void *)(("AA") + 1) -
(int)(const void *)("AA") == 1)
         && (__s2_len = strlen ("AA"), __s2_len < 4)
         ? (__builtin_constant_p (argv[0])
            && ((int)(const void *)((argv[0]) + 1) - (int)(const void
*)(argv[0]) == 1)
            ? 1
            : (({
              __const unsigned char *__s1 = (__const unsigned char *) (__const
char *) (argv[0]);
              register int __result = __s1[0] - ((__const unsigned char *)
(__const char *) ("AA"))[0];
              if (__s2_len > 0 && __result == 0)
                {
                  __result = (__s1[1] - ((__const unsigned char *) (__const
char *) ("AA"))[1]);
                  if (__s2_len > 1 && __result == 0)
                    {
                      __result = (__s1[2] - ((__const unsigned char *) (__const
char *) ("AA"))[2]);
                      if (__s2_len > 2 && __result == 0)
                        __result = (__s1[3] - ((__const  unsigned  char  *)
(__const  char  *) ("AA"))[3]);
                    }
                }
              __result;
            })))
         : 0))); }));

  return 0;
}


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=35903


      parent reply	other threads:[~2010-02-20  0:19 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-04-10 18:44 [Bug c/35903] New: false " rsa at us dot ibm dot com
2008-04-10 18:58 ` [Bug c/35903] " rsa at us dot ibm dot com
2008-04-10 18:59 ` rsa at us dot ibm dot com
2009-10-16 16:51 ` [Bug middle-end/35903] " cepeda at gmail dot com
2009-10-17 11:03 ` manu at gcc dot gnu dot org
2009-10-22 17:56 ` manu at gcc dot gnu dot org
2009-10-22 18:30 ` cepeda at gmail dot com
2009-10-22 18:32 ` cepeda at gmail dot com
2010-01-02 19:24 ` [Bug middle-end/35903] false uninitialized " rguenth at gcc dot gnu dot org
2010-02-19 23:56 ` [Bug middle-end/35903] false Warray-bounds " manu at gcc dot gnu dot org
2010-02-20  0:19 ` manu at gcc dot gnu dot org [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20100220001914.5572.qmail@sourceware.org \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).