public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/67093] New: incorrect -Wnonnull text for execl family of functions
@ 2015-08-02  0:07 msebor at gcc dot gnu.org
  2015-08-02  3:11 ` [Bug c/67093] " pinskia at gcc dot gnu.org
                   ` (5 more replies)
  0 siblings, 6 replies; 7+ messages in thread
From: msebor at gcc dot gnu.org @ 2015-08-02  0:07 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67093

            Bug ID: 67093
           Summary: incorrect -Wnonnull text for execl family of functions
           Product: gcc
           Version: 5.1.0
            Status: UNCONFIRMED
          Severity: minor
          Priority: P3
         Component: c
          Assignee: unassigned at gcc dot gnu.org
          Reporter: msebor at gcc dot gnu.org
  Target Milestone: ---

When the execl function is invoked with a null second argument, GCC issues two
warnings, one saying "null argument where non-null required" and another "not
enough variable arguments to fit a sentinel."

The text of the first warning is incorrect.  POSIX doesn't require that arg0 be
non-null, it only suggests that it point to a filename string.  C also doesn't
require that argv[0] be non-null.  The text of the second warning is
misleading.  However, since many programs assume that argv[0] is non-null, a
warning is helpful, but the text should be adjusted so as not to imply stronger
requirements than POSIX imposes on strictly conforming programs.  For instance,
the wording could be changed to say "null argument where non-null usually
expected."

$ cat t.c && ~/bin/powerpc64/bin/gcc -Wall t.c && ./a.out
#include <assert.h>
#include <stdio.h>
#include <unistd.h>

int main (int argc, char *argv[])
{
    if (0 < argc)
        execl (argv [0], (void*)0);

    printf ("argv[argc] = %s\n", argv [argc] ? argv [argc] : "null");

    assert (0 == argv [argc]);

    return 0;
}
t.c: In function ‘main’:
t.c:8:9: warning: null argument where non-null required (argument 2)
[-Wnonnull]
         execl (argv [0], (void*)0);
         ^
t.c:8:9: warning: not enough variable arguments to fit a sentinel [-Wformat=]
argv[argc] = null
>From gcc-bugs-return-493883-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org Sun Aug 02 01:18:29 2015
Return-Path: <gcc-bugs-return-493883-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org>
Delivered-To: listarch-gcc-bugs@gcc.gnu.org
Received: (qmail 126140 invoked by alias); 2 Aug 2015 01:18:28 -0000
Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm
Precedence: bulk
List-Id: <gcc-bugs.gcc.gnu.org>
List-Archive: <http://gcc.gnu.org/ml/gcc-bugs/>
List-Post: <mailto:gcc-bugs@gcc.gnu.org>
List-Help: <mailto:gcc-bugs-help@gcc.gnu.org>
Sender: gcc-bugs-owner@gcc.gnu.org
Delivered-To: mailing list gcc-bugs@gcc.gnu.org
Received: (qmail 126029 invoked by uid 55); 2 Aug 2015 01:18:17 -0000
From: "ctice at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug bootstrap/66521] xgcc: cc1plus segfaults when compiling libstdc++-v3/src/c++11/ostream-inst.cc
Date: Sun, 02 Aug 2015 01:18:00 -0000
X-Bugzilla-Reason: CC
X-Bugzilla-Type: changed
X-Bugzilla-Watch-Reason: None
X-Bugzilla-Product: gcc
X-Bugzilla-Component: bootstrap
X-Bugzilla-Version: 6.0
X-Bugzilla-Keywords:
X-Bugzilla-Severity: normal
X-Bugzilla-Who: ctice at gcc dot gnu.org
X-Bugzilla-Status: UNCONFIRMED
X-Bugzilla-Resolution:
X-Bugzilla-Priority: P3
X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org
X-Bugzilla-Target-Milestone: ---
X-Bugzilla-Flags:
X-Bugzilla-Changed-Fields:
Message-ID: <bug-66521-4-6Bri9nchBn@http.gcc.gnu.org/bugzilla/>
In-Reply-To: <bug-66521-4@http.gcc.gnu.org/bugzilla/>
References: <bug-66521-4@http.gcc.gnu.org/bugzilla/>
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: 7bit
X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/
Auto-Submitted: auto-generated
MIME-Version: 1.0
X-SW-Source: 2015-08/txt/msg00025.txt.bz2
Content-length: 2410

https://gcc.gnu.org/bugzilla/show_bug.cgi?idf521

--- Comment #10 from ctice at gcc dot gnu.org ---
Author: ctice
Date: Sun Aug  2 01:17:39 2015
New Revision: 226471

URL: https://gcc.gnu.org/viewcvs?rev"6471&root=gcc&view=rev
Log:
Fix PR 66521

libvtv/ChangeLog

2015-08-01  Caroline Tice  <cmtice@google.com>

        PR 66521
        * Makefile.am: Update to match latest tree.
        * Makefile.in: Regenerate.
        * testsuite/lib/libvtv: Brought up to date.
        * vtv_malloc.cc (VTV_DEBUG): Update function call to match renamed
        function (old bug!).
        * vtv_rts.cc (debug_functions, debug_init, debug_verify_vtable): Update
        initializations to work correctly with VTV_DEBUG defined.

gcc/ChangeLog:

2015-08-01  Caroline Tice  <cmtice@google.com>

        PR 66521
        * vtable-verify.c (vtbl_mangled_name_types, vtbl_mangled_name_ids): New
        global variables.
        (vtbl_find_mangled_name):  New function.
        (vtbl_register_mangled_name):  New function.
        (vtbl_map_get_node):  If DECL_ASSEMBLER_NAME is "<anon>", look up
        mangled name in mangled name vectors.
        (find_or_create_vtbl_map_node):  Ditto.
        (var_is_used_for_virtual_call_p):  Add recursion_depth parameter;
        update recursion_depth on function entry; pass it to every recursive
        call; automatically exit if depth > 25 (give up looking at that point).
        (verify_bb_vtables):  Initialize recursion_depth and pass it to
        var_is_used_for_virtual_call_p.
        * vtable-verify.h (vtbl_mangbled_name_types, vtbl_mangled_name_ids):
New
        global variable decls.
        (vtbl_register_mangled_name): New extern function decl.

gcc/cp/ChangeLog:
2015-08-01  Caroline Tice  <cmtice@google.com>

        PR 66521
        * mangle.c : Add vtable-verify.h to include files.
        (get_mangled_vtable_map_var_name):  If the DECL_ASSEMBLER_NAME
        is "<anon>" get the real mangled name for the class instead, and
        also store the real mangled name in a vector for use later.


Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/cp/ChangeLog
    trunk/gcc/cp/mangle.c
    trunk/gcc/vtable-verify.c
    trunk/gcc/vtable-verify.h
    trunk/libvtv/ChangeLog
    trunk/libvtv/testsuite/Makefile.am
    trunk/libvtv/testsuite/Makefile.in
    trunk/libvtv/testsuite/lib/libvtv.exp
    trunk/libvtv/vtv_malloc.cc
    trunk/libvtv/vtv_rts.cc


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

end of thread, other threads:[~2015-08-03 16:15 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-08-02  0:07 [Bug c/67093] New: incorrect -Wnonnull text for execl family of functions msebor at gcc dot gnu.org
2015-08-02  3:11 ` [Bug c/67093] " pinskia at gcc dot gnu.org
2015-08-02 15:38 ` msebor at gcc dot gnu.org
2015-08-03  2:50 ` pinskia at gcc dot gnu.org
2015-08-03 14:58 ` msebor at gcc dot gnu.org
2015-08-03 15:55 ` redi at gcc dot gnu.org
2015-08-03 16:15 ` msebor at gcc dot gnu.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).