public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/23915] New: Missing -Wstrict-aliasing warning
@ 2005-09-16 12:01 larschri at pvv dot ntnu dot no
  2005-09-16 13:25 ` [Bug c++/23915] " bangerth at dealii dot org
  2005-09-16 14:15 ` pinskia at gcc dot gnu dot org
  0 siblings, 2 replies; 3+ messages in thread
From: larschri at pvv dot ntnu dot no @ 2005-09-16 12:01 UTC (permalink / raw)
  To: gcc-bugs

I get warning when compiling the following program as C, but not as C++. I have
experienced that such casts can fail for both C and C++ programs when running
with option -O2. See also [Bug c/23913].

int main() {
  float f = 4.5;
  int i =    *((int*)&f);
  (void)i;
  return 0;
}


$ g++ -Wstrict-aliasing -O2 foo.cpp
$ g++ --version
g++ (GCC) 4.0.1 20050727 (Red Hat 4.0.1-5)
Copyright (C) 2005 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
$ gcc -Wstrict-aliasing -O2 foo.c
cast-bug.c: In function 'main':
cast-bug.c:5: warning: dereferencing type-punned pointer will break
strict-aliasing rules

-- 
           Summary: Missing -Wstrict-aliasing warning
           Product: gcc
           Version: 4.0.1
            Status: UNCONFIRMED
          Severity: enhancement
          Priority: P2
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: larschri at pvv dot ntnu dot no
                CC: gcc-bugs at gcc dot gnu dot org


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


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

* [Bug c++/23915] Missing -Wstrict-aliasing warning
  2005-09-16 12:01 [Bug c++/23915] New: Missing -Wstrict-aliasing warning larschri at pvv dot ntnu dot no
@ 2005-09-16 13:25 ` bangerth at dealii dot org
  2005-09-16 14:15 ` pinskia at gcc dot gnu dot org
  1 sibling, 0 replies; 3+ messages in thread
From: bangerth at dealii dot org @ 2005-09-16 13:25 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From bangerth at dealii dot org  2005-09-16 13:25 -------
Confirmed. 

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
     Ever Confirmed|                            |1
           Keywords|                            |diagnostic
   Last reconfirmed|0000-00-00 00:00:00         |2005-09-16 13:25:05
               date|                            |


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


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

* [Bug c++/23915] Missing -Wstrict-aliasing warning
  2005-09-16 12:01 [Bug c++/23915] New: Missing -Wstrict-aliasing warning larschri at pvv dot ntnu dot no
  2005-09-16 13:25 ` [Bug c++/23915] " bangerth at dealii dot org
@ 2005-09-16 14:15 ` pinskia at gcc dot gnu dot org
  1 sibling, 0 replies; 3+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-09-16 14:15 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2005-09-16 14:14 -------
This really a dup of bug 14024.

*** This bug has been marked as a duplicate of 14024 ***

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |DUPLICATE


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


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

end of thread, other threads:[~2005-09-16 14:15 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-09-16 12:01 [Bug c++/23915] New: Missing -Wstrict-aliasing warning larschri at pvv dot ntnu dot no
2005-09-16 13:25 ` [Bug c++/23915] " bangerth at dealii dot org
2005-09-16 14:15 ` 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).