public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug tree-optimization/101272] New: [12 Regression] error: ‘nonnull’ argument ‘message’ compared to NULL [-Werror=nonnull-compare] since
@ 2021-06-30 14:50 marxin at gcc dot gnu.org
  2021-06-30 15:30 ` [Bug tree-optimization/101272] [12 Regression] error: ‘nonnull’ argument ‘message’ compared to NULL [-Werror=nonnull-compare] since r12-1805 msebor at gcc dot gnu.org
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: marxin at gcc dot gnu.org @ 2021-06-30 14:50 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 101272
           Summary: [12 Regression] error: ‘nonnull’ argument ‘message’
                    compared to NULL [-Werror=nonnull-compare] since
           Product: gcc
           Version: 12.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: tree-optimization
          Assignee: unassigned at gcc dot gnu.org
          Reporter: marxin at gcc dot gnu.org
                CC: msebor at gcc dot gnu.org
  Target Milestone: ---

Seen in gdb package, the error is likely fine, but I'm curious why is it
visible since the mentioned revision?

$ cat gdb.ii
void internal_error(char);
struct compiled_regex {
  compiled_regex(const char *) __attribute__((__nonnull__));
};
compiled_regex::compiled_regex(const char *message) {
  (message != __null) ? 0 : (internal_error(0), 0);
}

$ g++ gdb.ii -c -Werror=nonnull-compare
gdb.ii: In constructor ‘compiled_regex::compiled_regex(const char*)’:
gdb.ii:6:23: error: ‘nonnull’ argument ‘message’ compared to NULL
[-Werror=nonnull-compare]
    6 |   (message != __null) ? 0 : (internal_error(0), 0);
      |   ~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~
cc1plus: some warnings being treated as errors

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

* [Bug tree-optimization/101272] [12 Regression] error: ‘nonnull’ argument ‘message’ compared to NULL [-Werror=nonnull-compare] since r12-1805
  2021-06-30 14:50 [Bug tree-optimization/101272] New: [12 Regression] error: ‘nonnull’ argument ‘message’ compared to NULL [-Werror=nonnull-compare] since marxin at gcc dot gnu.org
@ 2021-06-30 15:30 ` msebor at gcc dot gnu.org
  2021-07-01  7:16 ` rguenth at gcc dot gnu.org
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: msebor at gcc dot gnu.org @ 2021-06-30 15:30 UTC (permalink / raw)
  To: gcc-bugs

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

Martin Sebor <msebor at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
            Summary|[12 Regression] error:      |[12 Regression] error:
                   |‘nonnull’ argument          |‘nonnull’ argument
                   |‘message’ compared to NULL  |‘message’ compared to NULL
                   |[-Werror=nonnull-compare]   |[-Werror=nonnull-compare]
                   |since                       |since r12-1805
           Keywords|                            |diagnostic

--- Comment #1 from Martin Sebor <msebor at gcc dot gnu.org> ---
The warning is valid and expected.  It started to be issued with r12-1805. 
Prior to that, the parentheses around the inequality expression suppressed it,
like so:

$ cat t.C && cc1plus.r12-1804 -quiet -Wall -Werror -o/dev/null t.C
__attribute__ ((nonnull)) void
f (int *p) { p == 0 ? __builtin_abort () : (void)0; }

__attribute__ ((nonnull)) void
g (int *p) { (p == 0) ? __builtin_abort () : (void)0; }

t.C: In function ‘void f(int*)’:
t.C:2:21: error: ‘nonnull’ argument ‘p’ compared to NULL
[-Werror=nonnull-compare]
    2 | f (int *p) { p == 0 ? __builtin_abort () : (void)0; }
      |              ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
cc1plus.r12-1804: all warnings being treated as errors

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

* [Bug tree-optimization/101272] [12 Regression] error: ‘nonnull’ argument ‘message’ compared to NULL [-Werror=nonnull-compare] since r12-1805
  2021-06-30 14:50 [Bug tree-optimization/101272] New: [12 Regression] error: ‘nonnull’ argument ‘message’ compared to NULL [-Werror=nonnull-compare] since marxin at gcc dot gnu.org
  2021-06-30 15:30 ` [Bug tree-optimization/101272] [12 Regression] error: ‘nonnull’ argument ‘message’ compared to NULL [-Werror=nonnull-compare] since r12-1805 msebor at gcc dot gnu.org
@ 2021-07-01  7:16 ` rguenth at gcc dot gnu.org
  2021-07-01  7:19 ` marxin at gcc dot gnu.org
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: rguenth at gcc dot gnu.org @ 2021-07-01  7:16 UTC (permalink / raw)
  To: gcc-bugs

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

Richard Biener <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|---                         |12.0

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

* [Bug tree-optimization/101272] [12 Regression] error: ‘nonnull’ argument ‘message’ compared to NULL [-Werror=nonnull-compare] since r12-1805
  2021-06-30 14:50 [Bug tree-optimization/101272] New: [12 Regression] error: ‘nonnull’ argument ‘message’ compared to NULL [-Werror=nonnull-compare] since marxin at gcc dot gnu.org
  2021-06-30 15:30 ` [Bug tree-optimization/101272] [12 Regression] error: ‘nonnull’ argument ‘message’ compared to NULL [-Werror=nonnull-compare] since r12-1805 msebor at gcc dot gnu.org
  2021-07-01  7:16 ` rguenth at gcc dot gnu.org
@ 2021-07-01  7:19 ` marxin at gcc dot gnu.org
  2021-07-01 14:38 ` msebor at gcc dot gnu.org
  2021-07-01 14:43 ` marxin at gcc dot gnu.org
  4 siblings, 0 replies; 6+ messages in thread
From: marxin at gcc dot gnu.org @ 2021-07-01  7:19 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #2 from Martin Liška <marxin at gcc dot gnu.org> ---
All right, so is the bug invalid, right?

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

* [Bug tree-optimization/101272] [12 Regression] error: ‘nonnull’ argument ‘message’ compared to NULL [-Werror=nonnull-compare] since r12-1805
  2021-06-30 14:50 [Bug tree-optimization/101272] New: [12 Regression] error: ‘nonnull’ argument ‘message’ compared to NULL [-Werror=nonnull-compare] since marxin at gcc dot gnu.org
                   ` (2 preceding siblings ...)
  2021-07-01  7:19 ` marxin at gcc dot gnu.org
@ 2021-07-01 14:38 ` msebor at gcc dot gnu.org
  2021-07-01 14:43 ` marxin at gcc dot gnu.org
  4 siblings, 0 replies; 6+ messages in thread
From: msebor at gcc dot gnu.org @ 2021-07-01 14:38 UTC (permalink / raw)
  To: gcc-bugs

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

Martin Sebor <msebor at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         Resolution|---                         |INVALID
             Status|UNCONFIRMED                 |RESOLVED

--- Comment #3 from Martin Sebor <msebor at gcc dot gnu.org> ---
Yes, let me close it.

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

* [Bug tree-optimization/101272] [12 Regression] error: ‘nonnull’ argument ‘message’ compared to NULL [-Werror=nonnull-compare] since r12-1805
  2021-06-30 14:50 [Bug tree-optimization/101272] New: [12 Regression] error: ‘nonnull’ argument ‘message’ compared to NULL [-Werror=nonnull-compare] since marxin at gcc dot gnu.org
                   ` (3 preceding siblings ...)
  2021-07-01 14:38 ` msebor at gcc dot gnu.org
@ 2021-07-01 14:43 ` marxin at gcc dot gnu.org
  4 siblings, 0 replies; 6+ messages in thread
From: marxin at gcc dot gnu.org @ 2021-07-01 14:43 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #4 from Martin Liška <marxin at gcc dot gnu.org> ---
Btw. moved to gdb bugzilla as
https://sourceware.org/bugzilla/show_bug.cgi?id=28042.

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

end of thread, other threads:[~2021-07-01 14:43 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-06-30 14:50 [Bug tree-optimization/101272] New: [12 Regression] error: ‘nonnull’ argument ‘message’ compared to NULL [-Werror=nonnull-compare] since marxin at gcc dot gnu.org
2021-06-30 15:30 ` [Bug tree-optimization/101272] [12 Regression] error: ‘nonnull’ argument ‘message’ compared to NULL [-Werror=nonnull-compare] since r12-1805 msebor at gcc dot gnu.org
2021-07-01  7:16 ` rguenth at gcc dot gnu.org
2021-07-01  7:19 ` marxin at gcc dot gnu.org
2021-07-01 14:38 ` msebor at gcc dot gnu.org
2021-07-01 14:43 ` marxin 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).