public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/36902]  New: [4.3/4.4 Regression]: Bogus array bound warning
@ 2008-07-22 18:44 hjl dot tools at gmail dot com
  2008-07-22 20:51 ` [Bug middle-end/36902] " pinskia at gcc dot gnu dot org
                   ` (34 more replies)
  0 siblings, 35 replies; 36+ messages in thread
From: hjl dot tools at gmail dot com @ 2008-07-22 18:44 UTC (permalink / raw)
  To: gcc-bugs

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain, Size: 1329 bytes --]

On Linux/x86-64, gcc 4.3/4.4 give:

[hjl@gnu-6 gcc]$ cat /tmp/y.c
/*
 * compile w/:
 * gcc -Wall -Werror -fno-strict-aliasing -O2 -c foo.c
 */

typedef unsigned char __u8;
typedef unsigned short __u16;

static inline void * foo(
    void * to, const void * from, int n)
{
    switch ( n )
    {
    case 3:
        *(__u16 *)to = *(const __u16 *)from;
        break;
    case 5:
        *((__u8 *)to + 4) = *((const __u8 *)from + 4);
        break;
    }
    return to;
}

int main(int argc, char *argv[])
{
    static char buf[64];
struct {
    __u16    size_of_select;
    __u8     pcr_select[4];
} sel;

    sel.size_of_select = 3;
    foo(buf, sel.pcr_select, sel.size_of_select);

    return 1;
}
[hjl@gnu-6 gcc]$ ./xgcc -B./ -Wall -Werror -fno-strict-aliasing -O2 -c /tmp/y.c
cc1: warnings being treated as errors
/tmp/y.c: In function âmainâ:
/tmp/y.c:18: error: array subscript is above array bounds
[hjl@gnu-6 gcc]$

Gcc 4.1 is OK.


-- 
           Summary: [4.3/4.4 Regression]: Bogus array bound warning
           Product: gcc
           Version: 4.4.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: hjl dot tools at gmail dot com


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


^ permalink raw reply	[flat|nested] 36+ messages in thread

end of thread, other threads:[~2009-04-18  9:30 UTC | newest]

Thread overview: 36+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-07-22 18:44 [Bug c/36902] New: [4.3/4.4 Regression]: Bogus array bound warning hjl dot tools at gmail dot com
2008-07-22 20:51 ` [Bug middle-end/36902] " pinskia at gcc dot gnu dot org
2008-07-22 21:13 ` hjl dot tools at gmail dot com
2008-07-22 21:19 ` [Bug middle-end/36902] Array bound warning with dead code after optimization pinskia at gcc dot gnu dot org
2008-07-22 21:27 ` paolo dot carlini at oracle dot com
2008-07-22 21:29 ` hjl dot tools at gmail dot com
2008-07-22 21:31 ` hjl dot tools at gmail dot com
2008-07-22 21:33 ` paolo dot carlini at oracle dot com
2008-07-22 21:43 ` hjl dot tools at gmail dot com
2008-07-22 22:54 ` paolo dot carlini at oracle dot com
2008-07-23  1:05 ` hjl dot tools at gmail dot com
2008-07-23  1:16 ` paolo dot carlini at oracle dot com
2008-07-23  1:24 ` hjl dot tools at gmail dot com
2008-07-23  1:29 ` paolo dot carlini at oracle dot com
2008-08-15 20:12 ` manu at gcc dot gnu dot org
2008-08-15 20:19 ` manu at gcc dot gnu dot org
2008-08-15 20:38 ` paolo dot carlini at oracle dot com
2008-08-22 16:45 ` manu at gcc dot gnu dot org
2008-08-22 17:06 ` manu at gcc dot gnu dot org
2008-08-22 17:31 ` pinskia at gcc dot gnu dot org
2008-08-22 17:38 ` hjl dot tools at gmail dot com
2008-08-22 17:55 ` manu at gcc dot gnu dot org
2008-08-25  8:01 ` mueller at gcc dot gnu dot org
2008-08-25 10:51 ` manu at gcc dot gnu dot org
2008-10-26 22:07 ` hjl dot tools at gmail dot com
2008-10-27  0:18 ` pinskia at gcc dot gnu dot org
2008-11-15  0:09 ` pinskia at gcc dot gnu dot org
2008-11-18 10:18 ` paolo dot carlini at oracle dot com
2008-11-18 14:43 ` hjl dot tools at gmail dot com
2008-11-18 15:23 ` manu at gcc dot gnu dot org
2008-11-18 15:27 ` paolo dot carlini at oracle dot com
2008-11-18 15:45 ` manu at gcc dot gnu dot org
2008-11-18 15:49 ` paolo dot carlini at oracle dot com
2008-11-18 16:07 ` manu at gcc dot gnu dot org
2009-04-18  9:25 ` manu at gcc dot gnu dot org
2009-04-18  9:30 ` manu at gcc dot gnu dot org

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).