public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/32511] [4.4/4.5/4.6 regression] GCC rejects inline+weak function
       [not found] <bug-32511-4@http.gcc.gnu.org/bugzilla/>
@ 2010-09-30 11:56 ` rguenth at gcc dot gnu.org
  2010-09-30 19:17 ` jason at gcc dot gnu.org
                   ` (7 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: rguenth at gcc dot gnu.org @ 2010-09-30 11:56 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Priority|P3                          |P2
         AssignedTo|rguenth at gcc dot gnu.org  |unassigned at gcc dot
                   |                            |gnu.org

--- Comment #10 from Richard Guenther <rguenth at gcc dot gnu.org> 2010-09-30 11:00:53 UTC ---
This bug has turned into a different one.  Not working on it.

In future please open new bugs instead of re-opening them and changing
them into sth completely different.


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

* [Bug c/32511] [4.4/4.5/4.6 regression] GCC rejects inline+weak function
       [not found] <bug-32511-4@http.gcc.gnu.org/bugzilla/>
  2010-09-30 11:56 ` [Bug c/32511] [4.4/4.5/4.6 regression] GCC rejects inline+weak function rguenth at gcc dot gnu.org
@ 2010-09-30 19:17 ` jason at gcc dot gnu.org
  2011-01-10 15:49 ` matz at gcc dot gnu.org
                   ` (6 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: jason at gcc dot gnu.org @ 2010-09-30 19:17 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #11 from Jason Merrill <jason at gcc dot gnu.org> 2010-09-30 16:01:01 UTC ---
I don't see it as different at all; I am arguing that the initial bug report
was not actually a bug, and that the patch should be reverted.


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

* [Bug c/32511] [4.4/4.5/4.6 regression] GCC rejects inline+weak function
       [not found] <bug-32511-4@http.gcc.gnu.org/bugzilla/>
  2010-09-30 11:56 ` [Bug c/32511] [4.4/4.5/4.6 regression] GCC rejects inline+weak function rguenth at gcc dot gnu.org
  2010-09-30 19:17 ` jason at gcc dot gnu.org
@ 2011-01-10 15:49 ` matz at gcc dot gnu.org
  2011-01-10 15:53 ` rguenth at gcc dot gnu.org
                   ` (5 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: matz at gcc dot gnu.org @ 2011-01-10 15:49 UTC (permalink / raw)
  To: gcc-bugs

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

Michael Matz <matz at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |matz at gcc dot gnu.org

--- Comment #12 from Michael Matz <matz at gcc dot gnu.org> 2011-01-10 15:46:31 UTC ---
Jason: you're right that there are historically multiple uses of 'weak'.  
But they conflict with each other.  If we regard it to merely allow
equivalent definitions in several translation units, then we indeed
could inline those, and the error Richard implemented would be wrong.

_But_ we wouldn't be able to describe the usecase that I think is actually
the one intended by the weak attribute, certainly the one that is deduced
from its ELF meaning, namely to allow interposition of a different
strong definition that isn't necessarily equivalent.

For that latter definition we must disallow inlining.

IMO we can't simply choose the first definition because it's broader
than the second, and also because it goes against the ELF specification.

If you need some attribute that follows the first definition I think
it should not be named weak, but rather something like 'comdat'.
Allow inline expansion, but also allow replacement by other definitions.

For a Novell bug-report (I think it can't be accessed from the outside)
I wrote this opinion about the connection between attribute weak and
the several possibilities of describing visibility and inlining:

-----------------------------------
I would propose the following semantics:
a) an explicit visibility attribute takes precedence (hence if marked
   weak and hidden, the weakness is ignored), alternatively this
   should be a warning
b) otherwise the symbol doesn't have explicit visibility, in other
   words it inherits from command line or block pragmas:
   in that case an additional weak attribute should cancel the visibility,
   as if it has default visibility (that will have the effect of
   disabling inlining, amongst other things)

An explicit inline attribute on a weak function should generate a warning
or error.
-----------------------------------

To add your desired semantics:
c) a 'comdat' attribute is compatible with inlining and visibility
   declarations (explicit or implicit) provided that all definitions
   of that symbol are marked 'comdat' and all of them are semantically
   equivalent


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

* [Bug c/32511] [4.4/4.5/4.6 regression] GCC rejects inline+weak function
       [not found] <bug-32511-4@http.gcc.gnu.org/bugzilla/>
                   ` (2 preceding siblings ...)
  2011-01-10 15:49 ` matz at gcc dot gnu.org
@ 2011-01-10 15:53 ` rguenth at gcc dot gnu.org
  2011-01-11 11:30 ` rguenth at gcc dot gnu.org
                   ` (4 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: rguenth at gcc dot gnu.org @ 2011-01-10 15:53 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #13 from Richard Guenther <rguenth at gcc dot gnu.org> 2011-01-10 15:48:51 UTC ---
The original problem was fixed for GCC 4.6 with

2010-09-24  Jan Hubicka  <jh@suse.cz>

        * lto-symtab.c (lto_symtab_entry_def): Add guessed field.
        (lto_symtab_resolve_symbols): Set it.
...
        * tree.h (DECL_REPLACEABLE_P): Remove.
        (decl_replaceable_p, decl_binds_to_current_def_p): Declare.
...
        * varasm.c (resolution_to_local_definition_p, resolution_local_p): New
        static functions.
        (default_binds_local_p_1): Use resolutoin info.
        (decl_binds_to_current_def_p, decl_replaceable_p): New functions.
...

thus the patch can be reverted on the trunk (I'll do that after a round
of testing).


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

* [Bug c/32511] [4.4/4.5 Regression] GCC rejects inline+weak function
       [not found] <bug-32511-4@http.gcc.gnu.org/bugzilla/>
                   ` (4 preceding siblings ...)
  2011-01-11 11:30 ` rguenth at gcc dot gnu.org
@ 2011-01-11 11:30 ` rguenth at gcc dot gnu.org
  2012-01-12 20:25 ` pinskia at gcc dot gnu.org
                   ` (2 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: rguenth at gcc dot gnu.org @ 2011-01-11 11:30 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |wrong-code
      Known to work|                            |4.6.0
            Summary|[4.4/4.5/4.6 regression]    |[4.4/4.5 Regression] GCC
                   |GCC rejects inline+weak     |rejects inline+weak
                   |function                    |function

--- Comment #15 from Richard Guenther <rguenth at gcc dot gnu.org> 2011-01-11 10:09:51 UTC ---
Fixed on trunk (both bugs).


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

* [Bug c/32511] [4.4/4.5/4.6 regression] GCC rejects inline+weak function
       [not found] <bug-32511-4@http.gcc.gnu.org/bugzilla/>
                   ` (3 preceding siblings ...)
  2011-01-10 15:53 ` rguenth at gcc dot gnu.org
@ 2011-01-11 11:30 ` rguenth at gcc dot gnu.org
  2011-01-11 11:30 ` [Bug c/32511] [4.4/4.5 Regression] " rguenth at gcc dot gnu.org
                   ` (3 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: rguenth at gcc dot gnu.org @ 2011-01-11 11:30 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #14 from Richard Guenther <rguenth at gcc dot gnu.org> 2011-01-11 10:09:19 UTC ---
Author: rguenth
Date: Tue Jan 11 10:09:15 2011
New Revision: 168652

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=168652
Log:
2011-01-12  Richard Guenther  <rguenther@suse.de>

    PR middle-end/32511
    * c-common.c (handle_weak_attribute): Warn instead of error
    on declaring an inline function weak.

    * gcc.dg/attr-weak-1.c: Adjust.

Modified:
    trunk/gcc/c-family/ChangeLog
    trunk/gcc/c-family/c-common.c
    trunk/gcc/testsuite/ChangeLog
    trunk/gcc/testsuite/gcc.dg/attr-weak-1.c


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

* [Bug c/32511] [4.4/4.5 Regression] GCC rejects inline+weak function
       [not found] <bug-32511-4@http.gcc.gnu.org/bugzilla/>
                   ` (5 preceding siblings ...)
  2011-01-11 11:30 ` [Bug c/32511] [4.4/4.5 Regression] " rguenth at gcc dot gnu.org
@ 2012-01-12 20:25 ` pinskia at gcc dot gnu.org
  2012-03-13 15:02 ` [Bug c/32511] [4.5 " jakub at gcc dot gnu.org
  2012-07-02  9:27 ` rguenth at gcc dot gnu.org
  8 siblings, 0 replies; 10+ messages in thread
From: pinskia at gcc dot gnu.org @ 2012-01-12 20:25 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|4.4.0                       |4.4.7


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

* [Bug c/32511] [4.5 Regression] GCC rejects inline+weak function
       [not found] <bug-32511-4@http.gcc.gnu.org/bugzilla/>
                   ` (6 preceding siblings ...)
  2012-01-12 20:25 ` pinskia at gcc dot gnu.org
@ 2012-03-13 15:02 ` jakub at gcc dot gnu.org
  2012-07-02  9:27 ` rguenth at gcc dot gnu.org
  8 siblings, 0 replies; 10+ messages in thread
From: jakub at gcc dot gnu.org @ 2012-03-13 15:02 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|4.4.7                       |4.5.4

--- Comment #16 from Jakub Jelinek <jakub at gcc dot gnu.org> 2012-03-13 12:47:21 UTC ---
4.4 branch is being closed, moving to 4.5.4 target.


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

* [Bug c/32511] [4.5 Regression] GCC rejects inline+weak function
       [not found] <bug-32511-4@http.gcc.gnu.org/bugzilla/>
                   ` (7 preceding siblings ...)
  2012-03-13 15:02 ` [Bug c/32511] [4.5 " jakub at gcc dot gnu.org
@ 2012-07-02  9:27 ` rguenth at gcc dot gnu.org
  8 siblings, 0 replies; 10+ messages in thread
From: rguenth at gcc dot gnu.org @ 2012-07-02  9:27 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|REOPENED                    |RESOLVED
         Resolution|                            |FIXED
   Target Milestone|4.5.4                       |4.6.0

--- Comment #17 from Richard Guenther <rguenth at gcc dot gnu.org> 2012-07-02 09:27:15 UTC ---
Fixed for 4.6.0


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

* [Bug c/32511] [4.4/4.5/4.6 regression] GCC rejects inline+weak function
  2007-06-26  5:30 [Bug c/32511] New: GCC inlines weak function sabre at nondot dot org
@ 2010-07-12 13:46 ` jason at gcc dot gnu dot org
  0 siblings, 0 replies; 10+ messages in thread
From: jason at gcc dot gnu dot org @ 2010-07-12 13:46 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #9 from jason at gcc dot gnu dot org  2010-07-12 13:46 -------
Marking as regression.  Weak symbols have multiple uses: allowing replacement
is one, but they are also used to allow equivalent definitions in multiple
translation units without linker errors.


-- 

jason at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|accepts-invalid, wrong-code |rejects-valid
            Summary|GCC inlines weak function   |[4.4/4.5/4.6 regression] GCC
                   |                            |rejects inline+weak function


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


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

end of thread, other threads:[~2012-07-02  9:27 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <bug-32511-4@http.gcc.gnu.org/bugzilla/>
2010-09-30 11:56 ` [Bug c/32511] [4.4/4.5/4.6 regression] GCC rejects inline+weak function rguenth at gcc dot gnu.org
2010-09-30 19:17 ` jason at gcc dot gnu.org
2011-01-10 15:49 ` matz at gcc dot gnu.org
2011-01-10 15:53 ` rguenth at gcc dot gnu.org
2011-01-11 11:30 ` rguenth at gcc dot gnu.org
2011-01-11 11:30 ` [Bug c/32511] [4.4/4.5 Regression] " rguenth at gcc dot gnu.org
2012-01-12 20:25 ` pinskia at gcc dot gnu.org
2012-03-13 15:02 ` [Bug c/32511] [4.5 " jakub at gcc dot gnu.org
2012-07-02  9:27 ` rguenth at gcc dot gnu.org
2007-06-26  5:30 [Bug c/32511] New: GCC inlines weak function sabre at nondot dot org
2010-07-12 13:46 ` [Bug c/32511] [4.4/4.5/4.6 regression] GCC rejects inline+weak function jason at gcc dot gnu dot 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).