public inbox for glibc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug libc/2926] New: assert macro contains unreachable code
@ 2006-07-14 19:55 Jerry dot James at usu dot edu
  2006-07-14 19:56 ` [Bug libc/2926] " Jerry dot James at usu dot edu
                   ` (5 more replies)
  0 siblings, 6 replies; 7+ messages in thread
From: Jerry dot James at usu dot edu @ 2006-07-14 19:55 UTC (permalink / raw)
  To: glibc-bugs

When compiling with gcc and the -Wunreachable-code flag, gcc warns about every
use of the assert macro from <assert.h>.  This was reported as a gcc bug (see
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=22414), but the gcc team declared it
to be a glibc bug.  Indeed, moving __ASSERT_VOID_CAST inward to apply to the two
instances of 0 in assert and assert_perror leaves the assertions working
correctly and eliminates the warnings for me.  I don't see a place to include a
patch on this page, so I'll submit the bug and hope I can attach a patch later.

-- 
           Summary: assert macro contains unreachable code
           Product: glibc
           Version: 2.4
            Status: NEW
          Severity: minor
          Priority: P3
         Component: libc
        AssignedTo: drepper at redhat dot com
        ReportedBy: Jerry dot James at usu dot edu
                CC: glibc-bugs at sources dot redhat dot com


http://sourceware.org/bugzilla/show_bug.cgi?id=2926

------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.


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

* [Bug libc/2926] assert macro contains unreachable code
  2006-07-14 19:55 [Bug libc/2926] New: assert macro contains unreachable code Jerry dot James at usu dot edu
@ 2006-07-14 19:56 ` Jerry dot James at usu dot edu
  2006-08-03  8:30 ` drepper at redhat dot com
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: Jerry dot James at usu dot edu @ 2006-07-14 19:56 UTC (permalink / raw)
  To: glibc-bugs


------- Additional Comments From Jerry dot James at usu dot edu  2006-07-14 19:56 -------
Created an attachment (id=1163)
 --> (http://sourceware.org/bugzilla/attachment.cgi?id=1163&action=view)
Proposed patch to assert.h


-- 


http://sourceware.org/bugzilla/show_bug.cgi?id=2926

------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.


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

* [Bug libc/2926] assert macro contains unreachable code
  2006-07-14 19:55 [Bug libc/2926] New: assert macro contains unreachable code Jerry dot James at usu dot edu
  2006-07-14 19:56 ` [Bug libc/2926] " Jerry dot James at usu dot edu
@ 2006-08-03  8:30 ` drepper at redhat dot com
  2007-04-20  7:15 ` roche+kml2 at exalead dot com
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: drepper at redhat dot com @ 2006-08-03  8:30 UTC (permalink / raw)
  To: glibc-bugs


------- Additional Comments From drepper at redhat dot com  2006-08-03 08:30 -------
Changed in CVS.

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


http://sourceware.org/bugzilla/show_bug.cgi?id=2926

------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.


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

* [Bug libc/2926] assert macro contains unreachable code
  2006-07-14 19:55 [Bug libc/2926] New: assert macro contains unreachable code Jerry dot James at usu dot edu
  2006-07-14 19:56 ` [Bug libc/2926] " Jerry dot James at usu dot edu
  2006-08-03  8:30 ` drepper at redhat dot com
@ 2007-04-20  7:15 ` roche+kml2 at exalead dot com
  2007-05-15  1:56 ` drepper at redhat dot com
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: roche+kml2 at exalead dot com @ 2007-04-20  7:15 UTC (permalink / raw)
  To: glibc-bugs


------- Additional Comments From roche+kml2 at exalead dot com  2007-04-20 08:14 -------
This patch now raises a new gcc warning when compiling with -W and -pedantic for
each assert() with a condition true at compile time.

The following code snippet demonstrates the isssue:

#include <assert.h>
void foo(void) { assert(sizeof(char) == 1); }


-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|RESOLVED                    |REOPENED
         Resolution|FIXED                       |


http://sourceware.org/bugzilla/show_bug.cgi?id=2926

------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.


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

* [Bug libc/2926] assert macro contains unreachable code
  2006-07-14 19:55 [Bug libc/2926] New: assert macro contains unreachable code Jerry dot James at usu dot edu
                   ` (2 preceding siblings ...)
  2007-04-20  7:15 ` roche+kml2 at exalead dot com
@ 2007-05-15  1:56 ` drepper at redhat dot com
  2007-06-01 13:33 ` roche+kml2 at exalead dot com
  2007-06-16 17:27 ` aj at suse dot de
  5 siblings, 0 replies; 7+ messages in thread
From: drepper at redhat dot com @ 2007-05-15  1:56 UTC (permalink / raw)
  To: glibc-bugs


------- Additional Comments From drepper at redhat dot com  2007-05-15 02:55 -------
I see no problem, it works fine for me.

-- 


http://sourceware.org/bugzilla/show_bug.cgi?id=2926

------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.


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

* [Bug libc/2926] assert macro contains unreachable code
  2006-07-14 19:55 [Bug libc/2926] New: assert macro contains unreachable code Jerry dot James at usu dot edu
                   ` (3 preceding siblings ...)
  2007-05-15  1:56 ` drepper at redhat dot com
@ 2007-06-01 13:33 ` roche+kml2 at exalead dot com
  2007-06-16 17:27 ` aj at suse dot de
  5 siblings, 0 replies; 7+ messages in thread
From: roche+kml2 at exalead dot com @ 2007-06-01 13:33 UTC (permalink / raw)
  To: glibc-bugs


------- Additional Comments From roche+kml2 at exalead dot com  2007-06-01 13:33 -------
The warning is only raised with GCC 3.3 (3.3.4), not GCC 4.1 (4.1.1):

$ gcc-3.3.4 -c test.c -Wall -pedantic
1.c: In function `foo':
1.c:2: warning: statement with no effect

$ gcc-4.1.1 -c 1.c -Wall -pedantic
(no warnings)



-- 


http://sourceware.org/bugzilla/show_bug.cgi?id=2926

------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.


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

* [Bug libc/2926] assert macro contains unreachable code
  2006-07-14 19:55 [Bug libc/2926] New: assert macro contains unreachable code Jerry dot James at usu dot edu
                   ` (4 preceding siblings ...)
  2007-06-01 13:33 ` roche+kml2 at exalead dot com
@ 2007-06-16 17:27 ` aj at suse dot de
  5 siblings, 0 replies; 7+ messages in thread
From: aj at suse dot de @ 2007-06-16 17:27 UTC (permalink / raw)
  To: glibc-bugs


------- Additional Comments From aj at suse dot de  2007-06-16 17:27 -------
(In reply to comment #5)
> The warning is only raised with GCC 3.3 (3.3.4), not GCC 4.1 (4.1.1):

In that case, let's close the bug as fixed since it's working with current GCC.

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|REOPENED                    |RESOLVED
         Resolution|                            |FIXED


http://sourceware.org/bugzilla/show_bug.cgi?id=2926

------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.


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

end of thread, other threads:[~2007-06-16 17:27 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-07-14 19:55 [Bug libc/2926] New: assert macro contains unreachable code Jerry dot James at usu dot edu
2006-07-14 19:56 ` [Bug libc/2926] " Jerry dot James at usu dot edu
2006-08-03  8:30 ` drepper at redhat dot com
2007-04-20  7:15 ` roche+kml2 at exalead dot com
2007-05-15  1:56 ` drepper at redhat dot com
2007-06-01 13:33 ` roche+kml2 at exalead dot com
2007-06-16 17:27 ` aj at suse dot de

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