This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug bootstrap/78859] New: profiledbootstrap failure caused by -Werror=nonnull
- From: "marxin at gcc dot gnu.org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Mon, 19 Dec 2016 13:07:01 +0000
- Subject: [Bug bootstrap/78859] New: profiledbootstrap failure caused by -Werror=nonnull
- Auto-submitted: auto-generated
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=78859
Bug ID: 78859
Summary: profiledbootstrap failure caused by -Werror=nonnull
Product: gcc
Version: unknown
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: bootstrap
Assignee: unassigned at gcc dot gnu.org
Reporter: marxin at gcc dot gnu.org
Target Milestone: ---
There are 2 (so far) errors reported:
1) gengtype.c:
../../gcc/gengtype.c: In function ‘const char*
get_file_srcdir_relative_path(const input_file*)’:
../../gcc/gengtype.c:1760:14: error: argument 1 null where non-null expected
[-Werror=nonnull]
if (strlen (f) > srcdir_len
~~~~~~~^~~
This is real bug, following patch fixes that:
diff --git a/gcc/gengtype.c b/gcc/gengtype.c
index dcc2ff5c358..138bb7c6588 100644
--- a/gcc/gengtype.c
+++ b/gcc/gengtype.c
@@ -1757,7 +1757,8 @@ const char *
get_file_srcdir_relative_path (const input_file *inpf)
{
const char *f = get_input_file_name (inpf);
- if (strlen (f) > srcdir_len
+ if (f != NULL
+ && strlen (f) > srcdir_len
&& IS_DIR_SEPARATOR (f[srcdir_len])
&& strncmp (f, srcdir, srcdir_len) == 0)
return f + srcdir_len + 1;
2) c-format.c
cc1plus: error: argument 1 null where non-null expected [-Werror=nonnull]
In file included from
/home/marxin/Programming/gcc/objdir/prev-x86_64-pc-linux-gnu/libstdc++-v3/include/cstring:42:0,
from ../../gcc/system.h:235,
from ../../gcc/c-family/c-format.c:21:
/usr/include/string.h:394:15: note: in a call to function ‘size_t strlen(const
char*)’ declared here
extern size_t strlen (const char *__s)
^~~~~~
It's more interesting as it's not real bug and will be probably similar to
PR78858:
133t.pre pass does:
<bb 98> [0.00%]:
_261 = strlen (0B);
_46 = (int) _261;
<bb 52> [19.09%]:
# _138 = PHI <0B(98), _78(144), _108(116), _108(132), _8(131), _108(123),
p_21(99)>
# prephitmp_211 = PHI <_46(98), iftmp.97_91(144), prephitmp_235(116),
prephitmp_235(132), iftmp.97_142(131), prephitmp_235(123), _51(99)>
format_types.300_56 = format_types;
where the only edge to 98 is:
# DEBUG attr_name => p_21
if (p_21 == 0B)
goto <bb 98>; [0.00%]
else
goto <bb 15>; [100.00%]
from:
<bb 98> [0.00%]:
<bb 52> [19.09%]:
# _138 = PHI <0B(98), _78(144), _108(116), _108(132), _8(131), _108(123),
p_21(99)>
# DEBUG attr_name => NULL
# DEBUG i => NULL
# DEBUG s => NULL
_52 = strlen (_138);
format_types.300_56 = format_types;
I'm attaching tree dumps of 131.crited1 and 133.pre