public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/23106] New: -Wstrict-aliasing=2 doesn't warn for all aliasing problems
@ 2005-07-27 23:37 fn_x at hotmail dot com
  2005-07-28  0:01 ` [Bug c/23106] " pinskia at gcc dot gnu dot org
                   ` (8 more replies)
  0 siblings, 9 replies; 10+ messages in thread
From: fn_x at hotmail dot com @ 2005-07-27 23:37 UTC (permalink / raw)
  To: gcc-bugs

Hi,

This program:

int main() {
    int a = 1;

    * (short *) (char *) &a = 2;

    char *p = (char *) &a;
    * (short *) p = 3;

    return a;
}

returns 1 when compiled with gcc 4.0.1 (nothing more is necessary than gcc -O2
test.c). However, adding -Wstrict-aliasing=2 does not make any warning for this
show up. This happens with void * as well.

I first asked about the first case on gcc-help, and Ian Lance Taylor followed up
with a patch to show a warning:
http://gcc.gnu.org/ml/gcc-help/2005-07/msg00292.html
For the second case, he asked to open a bug here.

-- 
           Summary: -Wstrict-aliasing=2 doesn't warn for all aliasing
                    problems
           Product: gcc
           Version: 4.0.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: c
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: fn_x at hotmail dot com
                CC: gcc-bugs at gcc dot gnu dot org
 GCC build triplet: i686-pc-linux-gnu
  GCC host triplet: i686-pc-linux-gnu
GCC target triplet: i686-pc-linux-gnu


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


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

end of thread, other threads:[~2005-07-29  5:58 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-07-27 23:37 [Bug c/23106] New: -Wstrict-aliasing=2 doesn't warn for all aliasing problems fn_x at hotmail dot com
2005-07-28  0:01 ` [Bug c/23106] " pinskia at gcc dot gnu dot org
2005-07-28  1:24 ` fn_x at hotmail dot com
2005-07-28  7:12 ` fn_x at hotmail dot com
2005-07-28 16:47 ` pinskia at gcc dot gnu dot org
2005-07-28 23:31 ` wilson at gcc dot gnu dot org
2005-07-28 23:42 ` cvs-commit at gcc dot gnu dot org
2005-07-29  0:24 ` cvs-commit at gcc dot gnu dot org
2005-07-29  0:46 ` wilson at gcc dot gnu dot org
2005-07-29  5:59 ` pinskia 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).