[Bug middle-end/56977] gcc -Og incorrectly warns about 'constant zero length parameter'

bastiaan at bjacques dot org gcc-bugzilla@gcc.gnu.org
Sun Jul 7 23:05:00 GMT 2013


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

Bastiaan Jacques <bastiaan at bjacques dot org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |bastiaan at bjacques dot org

--- Comment #7 from Bastiaan Jacques <bastiaan at bjacques dot org> ---
The following program fd.cc:

#include <sys/select.h>

int some_socket = 0;

void
foo()
{
    fd_set fdset;
    struct timeval tval;

    FD_ZERO(&fdset);
    FD_SET(some_socket, &fdset);
}

When compiled with:

g++ -c -o fd.o fd.cc  -D_FORTIFY_SOURCE=2  -Og

Generates the following warning:

fd.cc:12:219: warning: call to ‘__fdelt_warn’ declared with attribute warning:
bit outside of fd_set selected [enabled by default]
     FD_SET(some_socket, &fdset);

I think this might be another instance of this bug, because it goes away when
switching to -O2 (but I don't have a 4.8 branch handy to test whether the fix
also resolved this case).


More information about the Gcc-bugs mailing list