public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/33925] gcc -Waddress lost some useful warnings
       [not found] <bug-33925-4@http.gcc.gnu.org/bugzilla/>
@ 2012-04-18 16:34 ` manu at gcc dot gnu.org
  2012-04-18 17:04 ` redi at gcc dot gnu.org
                   ` (8 subsequent siblings)
  9 siblings, 0 replies; 10+ messages in thread
From: manu at gcc dot gnu.org @ 2012-04-18 16:34 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=33925

Manuel López-Ibáñez <manu at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |diagnostic
             Target|i686-pc-linux-gnu           |
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2012-04-18
               Host|i686-pc-linux-gnu           |
     Ever Confirmed|0                           |1
              Build|i686-pc-linux-gnu           |

--- Comment #4 from Manuel López-Ibáñez <manu at gcc dot gnu.org> 2012-04-18 16:32:46 UTC ---
OK, but I don't think anyone is going to step up soon to implement this, so
feel free to give it a try yourself.


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

* [Bug c++/33925] gcc -Waddress lost some useful warnings
       [not found] <bug-33925-4@http.gcc.gnu.org/bugzilla/>
  2012-04-18 16:34 ` [Bug c++/33925] gcc -Waddress lost some useful warnings manu at gcc dot gnu.org
@ 2012-04-18 17:04 ` redi at gcc dot gnu.org
  2012-04-18 17:07 ` redi at gcc dot gnu.org
                   ` (7 subsequent siblings)
  9 siblings, 0 replies; 10+ messages in thread
From: redi at gcc dot gnu.org @ 2012-04-18 17:04 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=33925

--- Comment #5 from Jonathan Wakely <redi at gcc dot gnu.org> 2012-04-18 17:01:23 UTC ---
(In reply to comment #3)
> First, I think the C++ standard forbids a function from having a null 
> address:

But GCC extensions allow it, see the weakref attribute:

http://gcc.gnu.org/onlinedocs/gcc/Function-Attributes.html#index-g_t_0040code_007bweakref_007d-attribute-2648

That's used (among other places) by GCC's pthreads abstraction layer to declare
a weak alias to pthread_create, which has a null address unless libpthread is
linked to.  Testing whether the address is null (i.. whether the application
was linked to libpthread) is used for important optimisations.


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

* [Bug c++/33925] gcc -Waddress lost some useful warnings
       [not found] <bug-33925-4@http.gcc.gnu.org/bugzilla/>
  2012-04-18 16:34 ` [Bug c++/33925] gcc -Waddress lost some useful warnings manu at gcc dot gnu.org
  2012-04-18 17:04 ` redi at gcc dot gnu.org
@ 2012-04-18 17:07 ` redi at gcc dot gnu.org
  2012-04-20 12:59 ` manu at gcc dot gnu.org
                   ` (6 subsequent siblings)
  9 siblings, 0 replies; 10+ messages in thread
From: redi at gcc dot gnu.org @ 2012-04-18 17:07 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=33925

--- Comment #6 from Jonathan Wakely <redi at gcc dot gnu.org> 2012-04-18 17:04:25 UTC ---
... That's not an argument against improving the warning though.  GCC's uses
occur in system headers so warnings are suppressed, and could be worked around
anyway with further extensions such as #pragma GCC diagnostic


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

* [Bug c++/33925] gcc -Waddress lost some useful warnings
       [not found] <bug-33925-4@http.gcc.gnu.org/bugzilla/>
                   ` (2 preceding siblings ...)
  2012-04-18 17:07 ` redi at gcc dot gnu.org
@ 2012-04-20 12:59 ` manu at gcc dot gnu.org
  2021-10-01 18:09 ` msebor at gcc dot gnu.org
                   ` (5 subsequent siblings)
  9 siblings, 0 replies; 10+ messages in thread
From: manu at gcc dot gnu.org @ 2012-04-20 12:59 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=33925

--- Comment #7 from Manuel López-Ibáñez <manu at gcc dot gnu.org> 2012-04-20 12:57:59 UTC ---
(In reply to comment #6)
> ... That's not an argument against improving the warning though.  GCC's uses
> occur in system headers so warnings are suppressed, and could be worked around
> anyway with further extensions such as #pragma GCC diagnostic

Or even better, only skip the warning for functions marked as weakref, which I
guess is a very small subset. I think a patch that did that would be accepted. 

Unfortunately, Michael, I don't think there is anyone with enough free time to
work on this, so if you submitted a patch, that would be great! Thanks.


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

* [Bug c++/33925] gcc -Waddress lost some useful warnings
       [not found] <bug-33925-4@http.gcc.gnu.org/bugzilla/>
                   ` (3 preceding siblings ...)
  2012-04-20 12:59 ` manu at gcc dot gnu.org
@ 2021-10-01 18:09 ` msebor at gcc dot gnu.org
  2021-10-04 19:20 ` [Bug c++/33925] [10/11/12 Regression] " msebor at gcc dot gnu.org
                   ` (4 subsequent siblings)
  9 siblings, 0 replies; 10+ messages in thread
From: msebor at gcc dot gnu.org @ 2021-10-01 18:09 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Assignee|unassigned at gcc dot gnu.org      |msebor at gcc dot gnu.org
                 CC|                            |msebor at gcc dot gnu.org
             Status|NEW                         |ASSIGNED

--- Comment #8 from Martin Sebor <msebor at gcc dot gnu.org> ---
With pr102103 resolved, let me handle this.

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

* [Bug c++/33925] [10/11/12 Regression] gcc -Waddress lost some useful warnings
       [not found] <bug-33925-4@http.gcc.gnu.org/bugzilla/>
                   ` (4 preceding siblings ...)
  2021-10-01 18:09 ` msebor at gcc dot gnu.org
@ 2021-10-04 19:20 ` msebor at gcc dot gnu.org
  2021-11-16 12:58 ` rguenth at gcc dot gnu.org
                   ` (3 subsequent siblings)
  9 siblings, 0 replies; 10+ messages in thread
From: msebor at gcc dot gnu.org @ 2021-10-04 19:20 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |patch
      Known to fail|                            |11.2.0, 12.0, 4.1.0
            Summary|gcc -Waddress lost some     |[10/11/12 Regression] gcc
                   |useful warnings             |-Waddress lost some useful
                   |                            |warnings

--- Comment #9 from Martin Sebor <msebor at gcc dot gnu.org> ---
As noted in comment 1, this is a regression.

Patch: https://gcc.gnu.org/pipermail/gcc-patches/2021-October/580899.html

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

* [Bug c++/33925] [10/11/12 Regression] gcc -Waddress lost some useful warnings
       [not found] <bug-33925-4@http.gcc.gnu.org/bugzilla/>
                   ` (5 preceding siblings ...)
  2021-10-04 19:20 ` [Bug c++/33925] [10/11/12 Regression] " msebor at gcc dot gnu.org
@ 2021-11-16 12:58 ` rguenth at gcc dot gnu.org
  2021-11-19 16:48 ` cvs-commit at gcc dot gnu.org
                   ` (2 subsequent siblings)
  9 siblings, 0 replies; 10+ messages in thread
From: rguenth at gcc dot gnu.org @ 2021-11-16 12:58 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Priority|P3                          |P2
   Target Milestone|---                         |10.4

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

* [Bug c++/33925] [10/11/12 Regression] gcc -Waddress lost some useful warnings
       [not found] <bug-33925-4@http.gcc.gnu.org/bugzilla/>
                   ` (6 preceding siblings ...)
  2021-11-16 12:58 ` rguenth at gcc dot gnu.org
@ 2021-11-19 16:48 ` cvs-commit at gcc dot gnu.org
  2021-11-19 16:49 ` [Bug c++/33925] [10/11 " msebor at gcc dot gnu.org
  2022-01-26 17:46 ` msebor at gcc dot gnu.org
  9 siblings, 0 replies; 10+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2021-11-19 16:48 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #10 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Martin Sebor <msebor@gcc.gnu.org>:

https://gcc.gnu.org/g:16137fbb9256ef365dd498d39024eb33de1a4cd8

commit r12-5410-g16137fbb9256ef365dd498d39024eb33de1a4cd8
Author: Martin Sebor <msebor@redhat.com>
Date:   Fri Nov 19 09:44:31 2021 -0700

    Restore ancient -Waddress for weak symbols [PR33925].

    Resolves:
    PR c/33925 - gcc -Waddress lost some useful warnings
    PR c/102867 - -Waddress from macro expansion in readelf.c

    gcc/c-family/ChangeLog:

            PR c++/33925
            PR c/102867
            * c-common.c (decl_with_nonnull_addr_p): Call maybe_nonzero_address
            and improve handling tof defined symbols.

    gcc/c/ChangeLog:

            PR c++/33925
            PR c/102867
            * c-typeck.c (maybe_warn_for_null_address): Suppress warnings for
            code resulting from macro expansion.

    gcc/cp/ChangeLog:

            PR c++/33925
            PR c/102867
            * typeck.c (warn_for_null_address): Suppress warnings for code
            resulting from macro expansion.

    gcc/ChangeLog:

            PR c++/33925
            PR c/102867
            * doc/invoke.texi (-Waddress): Update.

    gcc/testsuite/ChangeLog:

            PR c++/33925
            PR c/102867
            * g++.dg/warn/Walways-true-2.C: Adjust to avoid a valid warning.
            * c-c++-common/Waddress-5.c: New test.
            * c-c++-common/Waddress-6.c: New test.
            * g++.dg/warn/Waddress-7.C: New test.
            * gcc.dg/Walways-true-2.c: Adjust to avoid a valid warning.
            * gcc.dg/weak/weak-3.c: Expect a warning.

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

* [Bug c++/33925] [10/11 Regression] gcc -Waddress lost some useful warnings
       [not found] <bug-33925-4@http.gcc.gnu.org/bugzilla/>
                   ` (7 preceding siblings ...)
  2021-11-19 16:48 ` cvs-commit at gcc dot gnu.org
@ 2021-11-19 16:49 ` msebor at gcc dot gnu.org
  2022-01-26 17:46 ` msebor at gcc dot gnu.org
  9 siblings, 0 replies; 10+ messages in thread
From: msebor at gcc dot gnu.org @ 2021-11-19 16:49 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
      Known to work|                            |12.0
            Summary|[10/11/12 Regression] gcc   |[10/11 Regression] gcc
                   |-Waddress lost some useful  |-Waddress lost some useful
                   |warnings                    |warnings
      Known to fail|12.0                        |10.2.0

--- Comment #11 from Martin Sebor <msebor at gcc dot gnu.org> ---
Fixed in GCC 12.

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

* [Bug c++/33925] [10/11 Regression] gcc -Waddress lost some useful warnings
       [not found] <bug-33925-4@http.gcc.gnu.org/bugzilla/>
                   ` (8 preceding siblings ...)
  2021-11-19 16:49 ` [Bug c++/33925] [10/11 " msebor at gcc dot gnu.org
@ 2022-01-26 17:46 ` msebor at gcc dot gnu.org
  9 siblings, 0 replies; 10+ messages in thread
From: msebor at gcc dot gnu.org @ 2022-01-26 17:46 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
         Resolution|---                         |FIXED
             Status|ASSIGNED                    |RESOLVED

--- Comment #12 from Martin Sebor <msebor at gcc dot gnu.org> ---
I'm not planning to backport the GCC 12 changes.

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

end of thread, other threads:[~2022-01-26 17:46 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <bug-33925-4@http.gcc.gnu.org/bugzilla/>
2012-04-18 16:34 ` [Bug c++/33925] gcc -Waddress lost some useful warnings manu at gcc dot gnu.org
2012-04-18 17:04 ` redi at gcc dot gnu.org
2012-04-18 17:07 ` redi at gcc dot gnu.org
2012-04-20 12:59 ` manu at gcc dot gnu.org
2021-10-01 18:09 ` msebor at gcc dot gnu.org
2021-10-04 19:20 ` [Bug c++/33925] [10/11/12 Regression] " msebor at gcc dot gnu.org
2021-11-16 12:58 ` rguenth at gcc dot gnu.org
2021-11-19 16:48 ` cvs-commit at gcc dot gnu.org
2021-11-19 16:49 ` [Bug c++/33925] [10/11 " msebor at gcc dot gnu.org
2022-01-26 17:46 ` 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).