[Bug bootstrap/78817] stage2 bootstrap failure in vec.h:1613:5: error: argument 1 null where non-null expected after r243661

2016-12-22 Thread jakub at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=78817

Jakub Jelinek  changed:

   What|Removed |Added

 Status|ASSIGNED|RESOLVED
 Resolution|--- |FIXED

--- Comment #22 from Jakub Jelinek  ---
Fixed.

[Bug bootstrap/78817] stage2 bootstrap failure in vec.h:1613:5: error: argument 1 null where non-null expected after r243661

2016-12-22 Thread jakub at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=78817

--- Comment #21 from Jakub Jelinek  ---
Author: jakub
Date: Thu Dec 22 08:53:56 2016
New Revision: 243883

URL: https://gcc.gnu.org/viewcvs?rev=243883=gcc=rev
Log:
PR bootstrap/78817
* vec.h (vec::safe_grow_cleared): Revert
2016-12-15 change.

Modified:
trunk/gcc/ChangeLog
trunk/gcc/vec.h

[Bug bootstrap/78817] stage2 bootstrap failure in vec.h:1613:5: error: argument 1 null where non-null expected after r243661

2016-12-21 Thread jakub at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=78817

--- Comment #20 from Jakub Jelinek  ---
Author: jakub
Date: Wed Dec 21 22:15:59 2016
New Revision: 243874

URL: https://gcc.gnu.org/viewcvs?rev=243874=gcc=rev
Log:
PR bootstrap/78817
* tree-pass.h (make_pass_post_ipa_warn): Declare.
* builtins.c (validate_arglist): Adjust get_nonnull_args call.
Check for NULL pointer argument to nonnull arg here.
(validate_arg): Revert 2016-12-14 changes.
* calls.h (get_nonnull_args): Remove declaration.
* tree-ssa-ccp.c: Include diagnostic-core.h.
(pass_data_post_ipa_warn): New variable.
(pass_post_ipa_warn): New class.
(pass_post_ipa_warn::execute): New method.
(make_pass_post_ipa_warn): New function.
* tree.h (get_nonnull_args): Declare.
* tree.c (get_nonnull_args): New function.
* calls.c (maybe_warn_null_arg): Removed.
(maybe_warn_null_arg): Removed.
(initialize_argument_information): Revert 2016-12-14 changes.
* passes.def: Add pass_post_ipa_warn after first ccp after IPA.
c-family/
* c-common.c (struct nonnull_arg_ctx): New type.
(check_function_nonnull): Return bool instead of void.  Use
nonnull_arg_ctx as context rather than just location_t.
(check_nonnull_arg): Adjust for the new context type, set
warned_p to true if a warning has been diagnosed.
(check_function_arguments): Return bool instead of void.
* c-common.h (check_function_arguments): Adjust prototype.
c/
* c-typeck.c (build_function_call_vec): If check_function_arguments
returns true, set TREE_NO_WARNING on CALL_EXPR.
cp/
* typeck.c (cp_build_function_call_vec): If check_function_arguments
returns true, set TREE_NO_WARNING on CALL_EXPR.
* call.c (build_over_call): Likewise.

Modified:
trunk/gcc/ChangeLog
trunk/gcc/builtins.c
trunk/gcc/c-family/ChangeLog
trunk/gcc/c-family/c-common.c
trunk/gcc/c-family/c-common.h
trunk/gcc/c/ChangeLog
trunk/gcc/c/c-typeck.c
trunk/gcc/calls.c
trunk/gcc/calls.h
trunk/gcc/cp/ChangeLog
trunk/gcc/cp/call.c
trunk/gcc/cp/typeck.c
trunk/gcc/passes.def
trunk/gcc/tree-pass.h
trunk/gcc/tree-ssa-ccp.c
trunk/gcc/tree.c
trunk/gcc/tree.h

[Bug bootstrap/78817] stage2 bootstrap failure in vec.h:1613:5: error: argument 1 null where non-null expected after r243661

2016-12-16 Thread msebor at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=78817

--- Comment #19 from Martin Sebor  ---
(In reply to dave.anglin from comment #18)
> The change didn't fix build on hppa-linux:

This should be fixed in the patch referenced in comment #16, though the patch
is yet to be reviewed and judging by the lively debate about the original
commit that introduced the warning it's not entirely clear if it will be
necessary.

[Bug bootstrap/78817] stage2 bootstrap failure in vec.h:1613:5: error: argument 1 null where non-null expected after r243661

2016-12-16 Thread dave.anglin at bell dot net
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=78817

--- Comment #18 from dave.anglin at bell dot net ---
On 2016-12-16, at 6:55 AM, rguenth at gcc dot gnu.org wrote:

> Please revert this - I've rejected similar patches from Martin Liska recently.
> You just slow down the compiler for no good reason (read: for a badly
> implemented warning)

The change didn't fix build on hppa-linux:

../../gcc/gcc/tree-vect-data-refs.c: In function ‘void
vect_permute_store_chain(
vec, unsigned int, gimple*, gimple_stmt_iterator*,
vec*)
’:
../../gcc/gcc/tree-vect-data-refs.c:4896:27: error: argument 2 null where
non-nu
ll expected [-Werror=nonnull]
length * sizeof (tree));
   ^
In file included from
/home/dave/gnu/gcc/objdir/prev-hppa-linux-gnu/libstdc++-v3
/include/cstring:42:0,
 from ../../gcc/gcc/system.h:235,
 from ../../gcc/gcc/tree-vect-data-refs.c:23:
/usr/include/string.h:42:14: note: in a call to function ‘void* memcpy(void*,
co
nst void*, size_t)’ declared here
 extern void *memcpy (void *__restrict __dest, const void *__restrict __src,
  ^~

--
John David Anglin   dave.ang...@bell.net

[Bug bootstrap/78817] stage2 bootstrap failure in vec.h:1613:5: error: argument 1 null where non-null expected after r243661

2016-12-16 Thread rguenth at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=78817

--- Comment #17 from Richard Biener  ---
(In reply to Martin Sebor from comment #15)
> Author: msebor
> Date: Fri Dec 16 02:57:22 2016
> New Revision: 243736
> 
> URL: https://gcc.gnu.org/viewcvs?rev=243736=gcc=rev
> Log:
> PR bootstrap/78817 - stage2 bootstrap failure in vec.h:1613:5: error:
> argument 1 null where non-null expected after r243661
> 
> gcc/ChangeLog:
>   * vec.h (vec::safe_grow_cleared): Assert
>   a pointer is non-null.
> 
> 
> Modified:
> trunk/gcc/ChangeLog
> trunk/gcc/vec.h

Please revert this - I've rejected similar patches from Martin Liska recently.
You just slow down the compiler for no good reason (read: for a badly
implemented warning)

[Bug bootstrap/78817] stage2 bootstrap failure in vec.h:1613:5: error: argument 1 null where non-null expected after r243661

2016-12-15 Thread msebor at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=78817

--- Comment #16 from Martin Sebor  ---
r243736 should avoid the warning in ordinary bootstrap.  A patch for most of
the profiledbootstrap warnings has been posted for review here:

https://gcc.gnu.org/ml/gcc-patches/2016-12/msg01437.html

[Bug bootstrap/78817] stage2 bootstrap failure in vec.h:1613:5: error: argument 1 null where non-null expected after r243661

2016-12-15 Thread msebor at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=78817

--- Comment #15 from Martin Sebor  ---
Author: msebor
Date: Fri Dec 16 02:57:22 2016
New Revision: 243736

URL: https://gcc.gnu.org/viewcvs?rev=243736=gcc=rev
Log:
PR bootstrap/78817 - stage2 bootstrap failure in vec.h:1613:5: error: argument
1 null where non-null expected after r243661

gcc/ChangeLog:
* vec.h (vec::safe_grow_cleared): Assert
a pointer is non-null.


Modified:
trunk/gcc/ChangeLog
trunk/gcc/vec.h

[Bug bootstrap/78817] stage2 bootstrap failure in vec.h:1613:5: error: argument 1 null where non-null expected after r243661

2016-12-15 Thread danglin at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=78817

John David Anglin  changed:

   What|Removed |Added

 CC||danglin at gcc dot gnu.org

--- Comment #14 from John David Anglin  ---
Also seen on hppa-unknownlinux-gnu.

[Bug bootstrap/78817] stage2 bootstrap failure in vec.h:1613:5: error: argument 1 null where non-null expected after r243661

2016-12-15 Thread msebor at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=78817

--- Comment #13 from Martin Sebor  ---
(In reply to Franz Sirl from comment #7)
> And on x86_64 a profiledbootstrap with --enable-checking=yes fails like this:

I have just confirmed this by doing the same.  My profiledbootstrap shows the
following warnings:

DiagnosticCount   UniqueFiles
-Wformat-length=  321
-Wimplicit-fallthrough=  58   114
-Wmaybe-uninitialized1065
-Wnonnull1764

With the following unique -Wnonnull instances: 
  cc1plus: warning: argument 1 null where non-null expected [-Wnonnull]
  /opt/notnfs/msebor/src/gcc/trunk/gcc/gengtype.c:1760
  /opt/notnfs/msebor/src/gcc/trunk/gcc/gengtype.c:1762
  /opt/notnfs/msebor/src/gcc/trunk/gcc/gengtype-parse.c:951
  /opt/notnfs/msebor/src/gcc/trunk/gcc/gengtype-parse.c:952
  /opt/notnfs/msebor/src/gcc/trunk/gcc/vec.h:1613

The -Wnonnull warnings all look justified to me (as best I can tell), but also
easily avoidable.

[Bug bootstrap/78817] stage2 bootstrap failure in vec.h:1613:5: error: argument 1 null where non-null expected after r243661

2016-12-15 Thread msebor at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=78817

--- Comment #12 from Martin Sebor  ---
(In reply to Segher Boessenkool from comment #3)
> It is a warning (as well as a bootstrap comparison error) on powerpc64-linux.
> You tested on powerpc64le-linux, different animal.

I missed that.  But I'm not able to reproduce the bootstrap comparison error
even on powerpc64-linux (on POWER8).  With the warning fixed my bootstrap just
completed.

[Bug bootstrap/78817] stage2 bootstrap failure in vec.h:1613:5: error: argument 1 null where non-null expected after r243661

2016-12-15 Thread jakub at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=78817

--- Comment #11 from Jakub Jelinek  ---
Looking at the gengtype.c case, I think it is quite common case.
static inline const char*
get_input_file_name (const input_file *inpf)
{
  if (inpf)
  return inpf->inpname;
  return NULL;
}

const char *
get_file_srcdir_relative_path (const input_file *inpf)
{
  const char *f = get_input_file_name (inpf);
  if (strlen (f) > srcdir_len

Of course, if somebody calls get_file_srcdir_relative_path with NULL argument,
it will mean UB in strlen, but that still does not mean that strlen is ever
called with NULL.  The conditional in the first function might be just because
it is used in multiple places, in some where it allows NULL arguments, in
others where it doesn't.
Warning about if you ever hit this spot in the source, it will be always UB is
sometimes useful.  But that is not the case here, the same source location is
represented by 2 or more calls and it is just one of those that the optimizers
can't prove is unreachable, but the user can know is impossible.  Strlen would
segfault anyway if it was ever true.

[Bug bootstrap/78817] stage2 bootstrap failure in vec.h:1613:5: error: argument 1 null where non-null expected after r243661

2016-12-15 Thread jakub at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=78817

--- Comment #10 from Jakub Jelinek  ---
Note, users that want this to be diagnosed reliably already can use
-fsanitize={returns-,}nonnull-attribute
So I think it is better to warn only about the obvious cases with very low
false positive rate, and leave the rest to the runtime.  Because there is
really nothing wrong on the testcases from profiledbootstrap (which is meant to
be supported without --disable-werror), and more importantly it is hard to
figure out what actually might be wrong and how to work around the false
positives.
The
PR bootstrap/78817
* vec.h (vec::quick_grow_cleared): Assert
postcondition.
( vec::safe_grow_cleared): Ditto.   
patch looks like alchemy, slows things actually down (and will not help with
--disable-checking anyway).

[Bug bootstrap/78817] stage2 bootstrap failure in vec.h:1613:5: error: argument 1 null where non-null expected after r243661

2016-12-15 Thread jakub at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=78817

Jakub Jelinek  changed:

   What|Removed |Added

 CC||jakub at gcc dot gnu.org

--- Comment #9 from Jakub Jelinek  ---
I think that proves the warning is done in a bad place, a warning with so many
false positives is something that will push users away from gcc (or in the
better case they'll just disable it).

I think much better would be to warn soon after IPA, say after ccp2 pass, where
we have already propagated constants after inlining, but where optimizations
like jump threading have not been performed yet.  Or move the warning out of
-Wall, ideally out of -Wextra too.  Or have 2 levels, one where it warns after
ccp2 (and which is enabled in -Wall or -Wextra), and another one where it
instead warns late, but has known high false positive rate.

[Bug bootstrap/78817] stage2 bootstrap failure in vec.h:1613:5: error: argument 1 null where non-null expected after r243661

2016-12-15 Thread trippels at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=78817

--- Comment #8 from Markus Trippelsdorf  ---
trippels@gcc2-power8 linux % cat sm_ftl.i
int sm_read_sector_zone;
int *sm_read_sector_buffer = _read_sector_zone;
int sm_read_sector() {
  __builtin_memset(sm_read_sector_buffer, 0, 1);
again:
  if (sm_read_sector_zone)
if (!sm_read_sector_buffer)
  return 0;
  goto again;
}
void sm_init_zone() {
  sm_read_sector();
  sm_read_sector();
}

trippels@gcc2-power8 linux % gcc -c -Wall -O2 sm_ftl.i
trippels@gcc2-power8 linux % gcc -c -Wall -O3 sm_ftl.i
sm_ftl.i: In function ‘sm_init_zone’:
sm_ftl.i:4:3: warning: argument 1 null where non-null expected [-Wnonnull]
   __builtin_memset(sm_read_sector_buffer, 0, 1);
   ^
sm_ftl.i:4:3: note: in a call to built-in function ‘__builtin_memset’

[Bug bootstrap/78817] stage2 bootstrap failure in vec.h:1613:5: error: argument 1 null where non-null expected after r243661

2016-12-15 Thread sirl at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=78817

Franz Sirl  changed:

   What|Removed |Added

 CC||sirl at gcc dot gnu.org

--- Comment #7 from Franz Sirl  ---
And on x86_64 a profiledbootstrap with --enable-checking=yes fails like this:

../../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
   ~~~^~~
In file included from
/home/fsirl/rpmbuild/BUILD/gcc-7.0.0-r243686/obj-x86_64-suse-linux/prev-x86_64-suse-linux/libstdc++-v3/include/cstring:42:0,
 from ../../gcc/system.h:235,
 from ../../gcc/gengtype.c:26:
/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)
   ^~
../../gcc/gengtype.c:1762:18: error: argument 1 null where non-null expected
[-Werror=nonnull]
   && strncmp (f, srcdir, srcdir_len) == 0)
  ^~~
In file included from
/home/fsirl/rpmbuild/BUILD/gcc-7.0.0-r243686/obj-x86_64-suse-linux/prev-x86_64-suse-linux/libstdc++-v3/include/cstring:42:0,
 from ../../gcc/system.h:235,
 from ../../gcc/gengtype.c:26:
/usr/include/string.h:143:12: note: in a call to function 'int strncmp(const
char*, const char*, size_t)' declared here
 extern int strncmp (const char *__s1, const char *__s2, size_t __n)
^~~
cc1plus: all warnings being treated as errors
Makefile:2596: recipe for target 'build/gengtype.o' failed
make[3]: *** [build/gengtype.o] Error 1
make[3]: *** Waiting for unfinished jobs
rm fsf-funding.pod gcov.pod cpp.pod gfdl.pod gpl.pod gccgo.pod gfortran.pod
gcc.pod gcov-tool.pod
make[3]: Leaving directory
'/home/fsirl/rpmbuild/BUILD/gcc-7.0.0-r243686/obj-x86_64-suse-linux/gcc'
Makefile:4728: recipe for target 'all-stagefeedback-gcc' failed
make[2]: *** [all-stagefeedback-gcc] Error 2
make[2]: Leaving directory
'/home/fsirl/rpmbuild/BUILD/gcc-7.0.0-r243686/obj-x86_64-suse-linux'
Makefile:24232: recipe for target 'stagefeedback-bubble' failed
make[1]: *** [stagefeedback-bubble] Error 2
make[1]: Leaving directory
'/home/fsirl/rpmbuild/BUILD/gcc-7.0.0-r243686/obj-x86_64-suse-linux'
Makefile:24251: recipe for target 'profiledbootstrap' failed
make: *** [profiledbootstrap] Error 2

[Bug bootstrap/78817] stage2 bootstrap failure in vec.h:1613:5: error: argument 1 null where non-null expected after r243661

2016-12-15 Thread trippels at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=78817

Markus Trippelsdorf  changed:

   What|Removed |Added

 CC||trippels at gcc dot gnu.org

--- Comment #6 from Markus Trippelsdorf  ---
There are also many new (bogus?) warnings during PGO/-O3 bootstrap.

[Bug bootstrap/78817] stage2 bootstrap failure in vec.h:1613:5: error: argument 1 null where non-null expected after r243661

2016-12-15 Thread sch...@linux-m68k.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=78817

--- Comment #5 from Andreas Schwab  ---
Also broken on ia64.

[Bug bootstrap/78817] stage2 bootstrap failure in vec.h:1613:5: error: argument 1 null where non-null expected after r243661

2016-12-15 Thread sch...@linux-m68k.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=78817

Andreas Schwab  changed:

   What|Removed |Added

   Host|powerpc64le-*-linux |

--- Comment #4 from Andreas Schwab  ---
Also broken on aarch64.

[Bug bootstrap/78817] stage2 bootstrap failure in vec.h:1613:5: error: argument 1 null where non-null expected after r243661

2016-12-15 Thread segher at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=78817

--- Comment #3 from Segher Boessenkool  ---
It is a warning (as well as a bootstrap comparison error) on powerpc64-linux.
You tested on powerpc64le-linux, different animal.

[Bug bootstrap/78817] stage2 bootstrap failure in vec.h:1613:5: error: argument 1 null where non-null expected after r243661

2016-12-14 Thread msebor at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=78817

Martin Sebor  changed:

   What|Removed |Added

   Keywords||patch

--- Comment #2 from Martin Sebor  ---
Patch for the warnings posted for review:
  https://gcc.gnu.org/ml/gcc-patches/2016-12/msg01324.html

Segher, I haven't had luck reproducing the bootstrap comparison failure on my
POWER8 machine.  If you are sure this patch causes it can you provide more
details (your configure options and anything else I might need to reproduce
it).

[Bug bootstrap/78817] stage2 bootstrap failure in vec.h:1613:5: error: argument 1 null where non-null expected after r243661

2016-12-14 Thread segher at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=78817

Segher Boessenkool  changed:

   What|Removed |Added

 CC||segher at gcc dot gnu.org

--- Comment #1 from Segher Boessenkool  ---
The comparison failure (as described in PR17308) is also caused by the patch
in PR17308.

[Bug bootstrap/78817] stage2 bootstrap failure in vec.h:1613:5: error: argument 1 null where non-null expected after r243661

2016-12-14 Thread msebor at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=78817

Martin Sebor  changed:

   What|Removed |Added

 Status|UNCONFIRMED |ASSIGNED
   Last reconfirmed||2016-12-14
   Assignee|unassigned at gcc dot gnu.org  |msebor at gcc dot 
gnu.org
 Ever confirmed|0   |1