public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/77299] No warning for unused "INT64_MAX" and similar constants
       [not found] <bug-77299-4@http.gcc.gnu.org/bugzilla/>
@ 2021-08-27 18:49 ` pinskia at gcc dot gnu.org
  2021-08-27 18:50 ` pinskia at gcc dot gnu.org
                   ` (14 subsequent siblings)
  15 siblings, 0 replies; 16+ messages in thread
From: pinskia at gcc dot gnu.org @ 2021-08-27 18:49 UTC (permalink / raw)
  To: gcc-bugs

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

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |diagnostic
   Last reconfirmed|                            |2021-08-27
     Ever confirmed|0                           |1
             Status|RESOLVED                    |NEW
         Resolution|DUPLICATE                   |---

--- Comment #2 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
This is not a dup of bug 77297 but there might be another bug this is a dup of
though.  The problem here is the macros come from system headers.

Using -Wsystem-headers allows for the warnings to get through.

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

* [Bug c++/77299] No warning for unused "INT64_MAX" and similar constants
       [not found] <bug-77299-4@http.gcc.gnu.org/bugzilla/>
  2021-08-27 18:49 ` [Bug c++/77299] No warning for unused "INT64_MAX" and similar constants pinskia at gcc dot gnu.org
@ 2021-08-27 18:50 ` pinskia at gcc dot gnu.org
  2021-11-22  9:35 ` pinskia at gcc dot gnu.org
                   ` (13 subsequent siblings)
  15 siblings, 0 replies; 16+ messages in thread
From: pinskia at gcc dot gnu.org @ 2021-08-27 18:50 UTC (permalink / raw)
  To: gcc-bugs

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

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|---                         |DUPLICATE

--- Comment #3 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
It is a dup of bug 77513 though.

*** This bug has been marked as a duplicate of bug 77513 ***

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

* [Bug c++/77299] No warning for unused "INT64_MAX" and similar constants
       [not found] <bug-77299-4@http.gcc.gnu.org/bugzilla/>
  2021-08-27 18:49 ` [Bug c++/77299] No warning for unused "INT64_MAX" and similar constants pinskia at gcc dot gnu.org
  2021-08-27 18:50 ` pinskia at gcc dot gnu.org
@ 2021-11-22  9:35 ` pinskia at gcc dot gnu.org
  2021-11-22  9:38 ` pinskia at gcc dot gnu.org
                   ` (12 subsequent siblings)
  15 siblings, 0 replies; 16+ messages in thread
From: pinskia at gcc dot gnu.org @ 2021-11-22  9:35 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #4 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Actually a dup of bug 57201.

*** This bug has been marked as a duplicate of bug 57201 ***

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

* [Bug c++/77299] No warning for unused "INT64_MAX" and similar constants
       [not found] <bug-77299-4@http.gcc.gnu.org/bugzilla/>
                   ` (2 preceding siblings ...)
  2021-11-22  9:35 ` pinskia at gcc dot gnu.org
@ 2021-11-22  9:38 ` pinskia at gcc dot gnu.org
  2021-11-22  9:38 ` pinskia at gcc dot gnu.org
                   ` (11 subsequent siblings)
  15 siblings, 0 replies; 16+ messages in thread
From: pinskia at gcc dot gnu.org @ 2021-11-22  9:38 UTC (permalink / raw)
  To: gcc-bugs

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

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|RESOLVED                    |NEW
         Resolution|DUPLICATE                   |---

--- Comment #5 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Actually let's reopen this one.

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

* [Bug c++/77299] No warning for unused "INT64_MAX" and similar constants
       [not found] <bug-77299-4@http.gcc.gnu.org/bugzilla/>
                   ` (3 preceding siblings ...)
  2021-11-22  9:38 ` pinskia at gcc dot gnu.org
@ 2021-11-22  9:38 ` pinskia at gcc dot gnu.org
  2021-11-22  9:52 ` [Bug c++/77299] [9/10/11/12 Regression] No warning for unused "INT64_MAX" and similar constants due macro tracking from system headers pinskia at gcc dot gnu.org
                   ` (10 subsequent siblings)
  15 siblings, 0 replies; 16+ messages in thread
From: pinskia at gcc dot gnu.org @ 2021-11-22  9:38 UTC (permalink / raw)
  To: gcc-bugs

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

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |fchelnokov at gmail dot com

--- Comment #6 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
*** Bug 103347 has been marked as a duplicate of this bug. ***

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

* [Bug c++/77299] [9/10/11/12 Regression] No warning for unused "INT64_MAX" and similar constants due macro tracking from system headers
       [not found] <bug-77299-4@http.gcc.gnu.org/bugzilla/>
                   ` (4 preceding siblings ...)
  2021-11-22  9:38 ` pinskia at gcc dot gnu.org
@ 2021-11-22  9:52 ` pinskia at gcc dot gnu.org
  2021-11-22  9:58 ` redi at gcc dot gnu.org
                   ` (9 subsequent siblings)
  15 siblings, 0 replies; 16+ messages in thread
From: pinskia at gcc dot gnu.org @ 2021-11-22  9:52 UTC (permalink / raw)
  To: gcc-bugs

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

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
            Summary|No warning for unused       |[9/10/11/12 Regression] No
                   |"INT64_MAX" and similar     |warning for unused
                   |constants due macro         |"INT64_MAX" and similar
                   |tracking from system        |constants due macro
                   |headers                     |tracking from system
                   |                            |headers
      Known to work|                            |5.1.0
   Target Milestone|---                         |9.5
      Known to fail|                            |6.1.0

--- Comment #7 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Note inconsistency of INT64_MIN vs INT64_MAX was "fixed" in GCC 9 in that now
INT64_MAX does not even warn.

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

* [Bug c++/77299] [9/10/11/12 Regression] No warning for unused "INT64_MAX" and similar constants due macro tracking from system headers
       [not found] <bug-77299-4@http.gcc.gnu.org/bugzilla/>
                   ` (5 preceding siblings ...)
  2021-11-22  9:52 ` [Bug c++/77299] [9/10/11/12 Regression] No warning for unused "INT64_MAX" and similar constants due macro tracking from system headers pinskia at gcc dot gnu.org
@ 2021-11-22  9:58 ` redi at gcc dot gnu.org
  2021-11-22 10:05 ` redi at gcc dot gnu.org
                   ` (8 subsequent siblings)
  15 siblings, 0 replies; 16+ messages in thread
From: redi at gcc dot gnu.org @ 2021-11-22  9:58 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #8 from Jonathan Wakely <redi at gcc dot gnu.org> ---
This has regression repeatedly.

GCC 5 warned about all the unused statements:

unused.C: In function 'int main()':
unused.C:5:12: warning: statement has no effect [-Wunused-value]
   INT64_MIN; // no warning
            ^
unused.C:6:12: warning: statement has no effect [-Wunused-value]
   INT64_MIN; // no warning
            ^
unused.C:7:12: warning: statement has no effect [-Wunused-value]
   INT64_MAX; // -Wunused-value
            ^
unused.C:8:12: warning: statement has no effect [-Wunused-value]
   INT64_MAX; // -Wunused-value
            ^
unused.C:9:4: warning: statement has no effect [-Wunused-value]
   1; // -Wunused-value
    ^
unused.C:10:4: warning: statement has no effect [-Wunused-value]
   0; // -Wunused-value
    ^
unused.C:11:16: warning: statement has no effect [-Wunused-value]
   INT64_MIN + 0; // -Wunused-value
                ^

GCC 6 lost the first two warnings:

unused.C: In function 'int main()':
unused.C:7:12: warning: statement has no effect [-Wunused-value]
   INT64_MAX; // -Wunused-value
            ^
unused.C:8:12: warning: statement has no effect [-Wunused-value]
   INT64_MAX; // -Wunused-value
            ^
unused.C:9:4: warning: statement has no effect [-Wunused-value]
   1; // -Wunused-value
    ^
unused.C:10:4: warning: statement has no effect [-Wunused-value]
   0; // -Wunused-value
    ^
unused.C:11:13: warning: statement has no effect [-Wunused-value]
   INT64_MIN + 0; // -Wunused-value
             ^

Then GCC 9 lost the next two:

unused.C: In function 'int main()':
unused.C:9:3: warning: statement has no effect [-Wunused-value]
    9 |   1; // -Wunused-value
      |   ^
unused.C:10:3: warning: statement has no effect [-Wunused-value]
   10 |   0; // -Wunused-value
      |   ^
unused.C:11:13: warning: statement has no effect [-Wunused-value]
   11 |   INT64_MIN + 0; // -Wunused-value
      |             ^

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

* [Bug c++/77299] [9/10/11/12 Regression] No warning for unused "INT64_MAX" and similar constants due macro tracking from system headers
       [not found] <bug-77299-4@http.gcc.gnu.org/bugzilla/>
                   ` (6 preceding siblings ...)
  2021-11-22  9:58 ` redi at gcc dot gnu.org
@ 2021-11-22 10:05 ` redi at gcc dot gnu.org
  2021-11-22 10:06 ` redi at gcc dot gnu.org
                   ` (7 subsequent siblings)
  15 siblings, 0 replies; 16+ messages in thread
From: redi at gcc dot gnu.org @ 2021-11-22 10:05 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #9 from Jonathan Wakely <redi at gcc dot gnu.org> ---
For the INT64_MIN case:

# 1 "unused.C"
int main()
{

# 5 "unused.C" 3 4
 (-9223372036854775807L -1)
# 5 "unused.C"
          ;
}

GCC 5 warned, but we lost the warning with r230365

For the INT64_MAX case:

# 3 "unused.C"
int main()
{

# 5 "unused.C" 3 4
 (9223372036854775807L)
# 5 "unused.C"
          ;
}

GCC 8 warned, but we lost the warning with r267272

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

* [Bug c++/77299] [9/10/11/12 Regression] No warning for unused "INT64_MAX" and similar constants due macro tracking from system headers
       [not found] <bug-77299-4@http.gcc.gnu.org/bugzilla/>
                   ` (7 preceding siblings ...)
  2021-11-22 10:05 ` redi at gcc dot gnu.org
@ 2021-11-22 10:06 ` redi at gcc dot gnu.org
  2021-11-22 10:08 ` jakub at gcc dot gnu.org
                   ` (6 subsequent siblings)
  15 siblings, 0 replies; 16+ messages in thread
From: redi at gcc dot gnu.org @ 2021-11-22 10:06 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #10 from Jonathan Wakely <redi at gcc dot gnu.org> ---
(In reply to Jonathan Wakely from comment #9)
> GCC 5 warned, but we lost the warning with r230365

That was "Merge C++ delayed folding branch."

> GCC 8 warned, but we lost the warning with r267272

And that was "C++: more location wrapper nodes (PR c++/43064, PR c++/43486)"

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

* [Bug c++/77299] [9/10/11/12 Regression] No warning for unused "INT64_MAX" and similar constants due macro tracking from system headers
       [not found] <bug-77299-4@http.gcc.gnu.org/bugzilla/>
                   ` (8 preceding siblings ...)
  2021-11-22 10:06 ` redi at gcc dot gnu.org
@ 2021-11-22 10:08 ` jakub at gcc dot gnu.org
  2021-11-22 11:03 ` redi at gcc dot gnu.org
                   ` (5 subsequent siblings)
  15 siblings, 0 replies; 16+ messages in thread
From: jakub at gcc dot gnu.org @ 2021-11-22 10:08 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #11 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
If it weren't for those *_MIN macros or NULL in C, we could have a hack that we
ignore system headers flag from macro locus if a macro in system headers
expands to a single token (e.g. in C++ NULL expands to __null or INT_MAX to
0x7fffffff etc.  So, do we want instead some pragma to temporarily do the
opposite of #pragma GCC system_header and another one to undo it?  Because
deciding what warning/error should be reported against the header that defines
a macro and what against the uses of the macro is otherwise extremely specific
to a particular diagnostics and how exactly the macros look like.

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

* [Bug c++/77299] [9/10/11/12 Regression] No warning for unused "INT64_MAX" and similar constants due macro tracking from system headers
       [not found] <bug-77299-4@http.gcc.gnu.org/bugzilla/>
                   ` (9 preceding siblings ...)
  2021-11-22 10:08 ` jakub at gcc dot gnu.org
@ 2021-11-22 11:03 ` redi at gcc dot gnu.org
  2021-11-22 11:18 ` redi at gcc dot gnu.org
                   ` (4 subsequent siblings)
  15 siblings, 0 replies; 16+ messages in thread
From: redi at gcc dot gnu.org @ 2021-11-22 11:03 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #12 from Jonathan Wakely <redi at gcc dot gnu.org> ---
(In reply to Jakub Jelinek from comment #11)
> So, do we want instead some pragma to temporarily do the
> opposite of #pragma GCC system_header and another one to undo it?

Something like PR 80472?

That would solve a number of libstdc++ bugs, like PR 58876.

And maybe PR 87614.

See also PR 43167 which is related to the general problem, but probably
wouldn't be helped by your suggestion unless we made 99% of libstdc++ headers
non-system headers and just treated small regions as "system headers".

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

* [Bug c++/77299] [9/10/11/12 Regression] No warning for unused "INT64_MAX" and similar constants due macro tracking from system headers
       [not found] <bug-77299-4@http.gcc.gnu.org/bugzilla/>
                   ` (10 preceding siblings ...)
  2021-11-22 11:03 ` redi at gcc dot gnu.org
@ 2021-11-22 11:18 ` redi at gcc dot gnu.org
  2022-03-22 10:36 ` rguenth at gcc dot gnu.org
                   ` (3 subsequent siblings)
  15 siblings, 0 replies; 16+ messages in thread
From: redi at gcc dot gnu.org @ 2021-11-22 11:18 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #13 from Jonathan Wakely <redi at gcc dot gnu.org> ---
For the "NULL hiding pedwarn about invalid C++11 code in C++98" case from PR
103347

#include <cstddef>
struct test {
    void *x = NULL; //invalid in C++03 mode
};
int main() {}

The missing warning regression started with r186977, when
-ftrack-macro-expansion=2 became the default.

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

* [Bug c++/77299] [9/10/11/12 Regression] No warning for unused "INT64_MAX" and similar constants due macro tracking from system headers
       [not found] <bug-77299-4@http.gcc.gnu.org/bugzilla/>
                   ` (11 preceding siblings ...)
  2021-11-22 11:18 ` redi at gcc dot gnu.org
@ 2022-03-22 10:36 ` rguenth at gcc dot gnu.org
  2022-05-27  9:36 ` [Bug c++/77299] [10/11/12/13 " rguenth at gcc dot gnu.org
                   ` (2 subsequent siblings)
  15 siblings, 0 replies; 16+ messages in thread
From: rguenth at gcc dot gnu.org @ 2022-03-22 10:36 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Priority|P3                          |P2

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

* [Bug c++/77299] [10/11/12/13 Regression] No warning for unused "INT64_MAX" and similar constants due macro tracking from system headers
       [not found] <bug-77299-4@http.gcc.gnu.org/bugzilla/>
                   ` (12 preceding siblings ...)
  2022-03-22 10:36 ` rguenth at gcc dot gnu.org
@ 2022-05-27  9:36 ` rguenth at gcc dot gnu.org
  2022-06-28 10:32 ` jakub at gcc dot gnu.org
  2023-07-07 10:31 ` [Bug c++/77299] [11/12/13/14 " rguenth at gcc dot gnu.org
  15 siblings, 0 replies; 16+ messages in thread
From: rguenth at gcc dot gnu.org @ 2022-05-27  9:36 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|9.5                         |10.4

--- Comment #14 from Richard Biener <rguenth at gcc dot gnu.org> ---
GCC 9 branch is being closed

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

* [Bug c++/77299] [10/11/12/13 Regression] No warning for unused "INT64_MAX" and similar constants due macro tracking from system headers
       [not found] <bug-77299-4@http.gcc.gnu.org/bugzilla/>
                   ` (13 preceding siblings ...)
  2022-05-27  9:36 ` [Bug c++/77299] [10/11/12/13 " rguenth at gcc dot gnu.org
@ 2022-06-28 10:32 ` jakub at gcc dot gnu.org
  2023-07-07 10:31 ` [Bug c++/77299] [11/12/13/14 " rguenth at gcc dot gnu.org
  15 siblings, 0 replies; 16+ messages in thread
From: jakub at gcc dot gnu.org @ 2022-06-28 10:32 UTC (permalink / raw)
  To: gcc-bugs

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

Jakub Jelinek <jakub at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|10.4                        |10.5

--- Comment #15 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
GCC 10.4 is being released, retargeting bugs to GCC 10.5.

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

* [Bug c++/77299] [11/12/13/14 Regression] No warning for unused "INT64_MAX" and similar constants due macro tracking from system headers
       [not found] <bug-77299-4@http.gcc.gnu.org/bugzilla/>
                   ` (14 preceding siblings ...)
  2022-06-28 10:32 ` jakub at gcc dot gnu.org
@ 2023-07-07 10:31 ` rguenth at gcc dot gnu.org
  15 siblings, 0 replies; 16+ messages in thread
From: rguenth at gcc dot gnu.org @ 2023-07-07 10:31 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|10.5                        |11.5

--- Comment #16 from Richard Biener <rguenth at gcc dot gnu.org> ---
GCC 10 branch is being closed.

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

end of thread, other threads:[~2023-07-07 10:31 UTC | newest]

Thread overview: 16+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <bug-77299-4@http.gcc.gnu.org/bugzilla/>
2021-08-27 18:49 ` [Bug c++/77299] No warning for unused "INT64_MAX" and similar constants pinskia at gcc dot gnu.org
2021-08-27 18:50 ` pinskia at gcc dot gnu.org
2021-11-22  9:35 ` pinskia at gcc dot gnu.org
2021-11-22  9:38 ` pinskia at gcc dot gnu.org
2021-11-22  9:38 ` pinskia at gcc dot gnu.org
2021-11-22  9:52 ` [Bug c++/77299] [9/10/11/12 Regression] No warning for unused "INT64_MAX" and similar constants due macro tracking from system headers pinskia at gcc dot gnu.org
2021-11-22  9:58 ` redi at gcc dot gnu.org
2021-11-22 10:05 ` redi at gcc dot gnu.org
2021-11-22 10:06 ` redi at gcc dot gnu.org
2021-11-22 10:08 ` jakub at gcc dot gnu.org
2021-11-22 11:03 ` redi at gcc dot gnu.org
2021-11-22 11:18 ` redi at gcc dot gnu.org
2022-03-22 10:36 ` rguenth at gcc dot gnu.org
2022-05-27  9:36 ` [Bug c++/77299] [10/11/12/13 " rguenth at gcc dot gnu.org
2022-06-28 10:32 ` jakub at gcc dot gnu.org
2023-07-07 10:31 ` [Bug c++/77299] [11/12/13/14 " rguenth 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).