Public bug reported:

This bug affects libc6-dev 2.4-1ubuntu12.3 (and, presumably, all
previous versions as well).

The assert and assert_perror macros, defined in /usr/include/assert.h,
contain unreachable code in the failure case. To reproduce, do the
following:

$ cat > test-assert.c <<_EOF
#include <assert.h>

int main(argc)
{
  assert(argc < 42);

  return 0;
}
_EOF

$ gcc -Wunreachable-code -o test-assert test-assert.c
test-assert.c: In function ‘main’:
test-assert.c:5: warning: will never be executed

gcc is correct, the problem is with the definition of assert (and
assert_perror as well). This has been reported and fixed upstream (see
http://sources.redhat.com/bugzilla/show_bug.cgi?id=2926 ), although the
fix which was accepted there could still be slightly improved upon (see
my pending report concerning that on
http://sources.redhat.com/bugzilla/show_bug.cgi?id=3991 ).

I am attaching a patch to solve the problem, adapted from the solution
used upstream with my added cleanup.

** Affects: glibc (Ubuntu)
     Importance: Undecided
         Status: Unconfirmed

-- 
[patch] assert and assert_perror macros contain unreachable code
https://launchpad.net/bugs/83811

-- 
ubuntu-bugs mailing list
ubuntu-bugs@lists.ubuntu.com
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs

Reply via email to