public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug middle-end/53476] New: [4.8 Regression] FAIL: gcc.dg/attr-weakref-1.c
@ 2012-05-24 14:32 hjl.tools at gmail dot com
  2012-05-24 15:33 ` [Bug middle-end/53476] " hjl.tools at gmail dot com
                   ` (11 more replies)
  0 siblings, 12 replies; 13+ messages in thread
From: hjl.tools at gmail dot com @ 2012-05-24 14:32 UTC (permalink / raw)
  To: gcc-bugs

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

             Bug #: 53476
           Summary: [4.8 Regression] FAIL: gcc.dg/attr-weakref-1.c
    Classification: Unclassified
           Product: gcc
           Version: 4.8.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: middle-end
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: hjl.tools@gmail.com


On Linux/x86, revision 187825 gave:

FAIL: gcc.dg/attr-weakref-1.c (test for excess errors)
Excess errors:
attr-weakref-1.c:(.text.startup+0x78): undefined reference to `Wv10a'
attr-weakref-1.c:(.text.startup+0x82): undefined reference to `Wv11a'

WARNING: gcc.dg/attr-weakref-1.c compilation failed to produce executable

Revision 187799 is OK.


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

* [Bug middle-end/53476] [4.8 Regression] FAIL: gcc.dg/attr-weakref-1.c
  2012-05-24 14:32 [Bug middle-end/53476] New: [4.8 Regression] FAIL: gcc.dg/attr-weakref-1.c hjl.tools at gmail dot com
@ 2012-05-24 15:33 ` hjl.tools at gmail dot com
  2012-05-24 17:57 ` hp at gcc dot gnu.org
                   ` (10 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: hjl.tools at gmail dot com @ 2012-05-24 15:33 UTC (permalink / raw)
  To: gcc-bugs

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

H.J. Lu <hjl.tools at gmail dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |hubicka at gcc dot gnu.org
   Target Milestone|---                         |4.8.0

--- Comment #1 from H.J. Lu <hjl.tools at gmail dot com> 2012-05-24 15:31:31 UTC ---
It is caused by revision 187823:

http://gcc.gnu.org/ml/gcc-cvs/2012-05/msg00820.html


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

* [Bug middle-end/53476] [4.8 Regression] FAIL: gcc.dg/attr-weakref-1.c
  2012-05-24 14:32 [Bug middle-end/53476] New: [4.8 Regression] FAIL: gcc.dg/attr-weakref-1.c hjl.tools at gmail dot com
  2012-05-24 15:33 ` [Bug middle-end/53476] " hjl.tools at gmail dot com
@ 2012-05-24 17:57 ` hp at gcc dot gnu.org
  2012-05-28 15:17 ` Greta.Yorsh at arm dot com
                   ` (9 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: hp at gcc dot gnu.org @ 2012-05-24 17:57 UTC (permalink / raw)
  To: gcc-bugs

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

Hans-Peter Nilsson <hp at gcc dot gnu.org> changed:

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

--- Comment #2 from Hans-Peter Nilsson <hp at gcc dot gnu.org> 2012-05-24 17:44:51 UTC ---
Must be universal; cris-elf too, 187822:187825.


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

* [Bug middle-end/53476] [4.8 Regression] FAIL: gcc.dg/attr-weakref-1.c
  2012-05-24 14:32 [Bug middle-end/53476] New: [4.8 Regression] FAIL: gcc.dg/attr-weakref-1.c hjl.tools at gmail dot com
  2012-05-24 15:33 ` [Bug middle-end/53476] " hjl.tools at gmail dot com
  2012-05-24 17:57 ` hp at gcc dot gnu.org
@ 2012-05-28 15:17 ` Greta.Yorsh at arm dot com
  2012-05-29 12:07 ` hubicka at gcc dot gnu.org
                   ` (8 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: Greta.Yorsh at arm dot com @ 2012-05-28 15:17 UTC (permalink / raw)
  To: gcc-bugs

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

Greta Yorsh <Greta.Yorsh at arm dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |Greta.Yorsh at arm dot com

--- Comment #3 from Greta Yorsh <Greta.Yorsh at arm dot com> 2012-05-28 14:56:47 UTC ---
Fails on arm-none-eabi too.

FAIL: gcc.dg/attr-weakref-1.c (test for excess errors)
Excess errors:
attr-weakref-1.c:(.text.startup+0x1c8): undefined reference to `Wv10a'
attr-weakref-1.c:(.text.startup+0x1cc): undefined reference to `Wv11a'

/work/builds/tst/install/bin/arm-none-eabi-gcc
/work/local-checkouts/gcc-fsf/gcc/testsuite/gcc.dg/attr-weakref-1.c
-fno-diagnostics-show-caret   -O2 -DSTACK_SIZE=16384 
/work/local-checkouts/gcc-fsf/gcc/testsuite/gcc.dg/attr-weakref-1a.c -o
/work/tmp/attr-weakref-1.exe
/tmp/cch8OVNm.o: In function `main':
attr-weakref-1.c:(.text.startup+0x1c8): undefined reference to `Wv10a'
attr-weakref-1.c:(.text.startup+0x1cc): undefined reference to `Wv11a'
collect2: error: ld returned 1 exit status


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

* [Bug middle-end/53476] [4.8 Regression] FAIL: gcc.dg/attr-weakref-1.c
  2012-05-24 14:32 [Bug middle-end/53476] New: [4.8 Regression] FAIL: gcc.dg/attr-weakref-1.c hjl.tools at gmail dot com
                   ` (2 preceding siblings ...)
  2012-05-28 15:17 ` Greta.Yorsh at arm dot com
@ 2012-05-29 12:07 ` hubicka at gcc dot gnu.org
  2012-05-29 13:26 ` ro at gcc dot gnu.org
                   ` (7 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: hubicka at gcc dot gnu.org @ 2012-05-29 12:07 UTC (permalink / raw)
  To: gcc-bugs

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

Jan Hubicka <hubicka at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         AssignedTo|unassigned at gcc dot       |hubicka at gcc dot gnu.org
                   |gnu.org                     |

--- Comment #4 from Jan Hubicka <hubicka at gcc dot gnu.org> 2012-05-29 12:05:55 UTC ---
Mine.


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

* [Bug middle-end/53476] [4.8 Regression] FAIL: gcc.dg/attr-weakref-1.c
  2012-05-24 14:32 [Bug middle-end/53476] New: [4.8 Regression] FAIL: gcc.dg/attr-weakref-1.c hjl.tools at gmail dot com
                   ` (3 preceding siblings ...)
  2012-05-29 12:07 ` hubicka at gcc dot gnu.org
@ 2012-05-29 13:26 ` ro at gcc dot gnu.org
  2012-09-07 12:06 ` rguenth at gcc dot gnu.org
                   ` (6 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: ro at gcc dot gnu.org @ 2012-05-29 13:26 UTC (permalink / raw)
  To: gcc-bugs

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

Rainer Orth <ro at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2012-05-29
                 CC|                            |ro at gcc dot gnu.org
     Ever Confirmed|0                           |1

--- Comment #5 from Rainer Orth <ro at gcc dot gnu.org> 2012-05-29 13:19:32 UTC ---
Right: same on Solaris both with native assembler/linker and gas/gld.

  Rainer


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

* [Bug middle-end/53476] [4.8 Regression] FAIL: gcc.dg/attr-weakref-1.c
  2012-05-24 14:32 [Bug middle-end/53476] New: [4.8 Regression] FAIL: gcc.dg/attr-weakref-1.c hjl.tools at gmail dot com
                   ` (4 preceding siblings ...)
  2012-05-29 13:26 ` ro at gcc dot gnu.org
@ 2012-09-07 12:06 ` rguenth at gcc dot gnu.org
  2012-09-26 21:58 ` sje at gcc dot gnu.org
                   ` (5 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: rguenth at gcc dot gnu.org @ 2012-09-07 12:06 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Priority|P3                          |P1


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

* [Bug middle-end/53476] [4.8 Regression] FAIL: gcc.dg/attr-weakref-1.c
  2012-05-24 14:32 [Bug middle-end/53476] New: [4.8 Regression] FAIL: gcc.dg/attr-weakref-1.c hjl.tools at gmail dot com
                   ` (5 preceding siblings ...)
  2012-09-07 12:06 ` rguenth at gcc dot gnu.org
@ 2012-09-26 21:58 ` sje at gcc dot gnu.org
  2012-09-26 22:04 ` sje at gcc dot gnu.org
                   ` (4 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: sje at gcc dot gnu.org @ 2012-09-26 21:58 UTC (permalink / raw)
  To: gcc-bugs


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

Steve Ellcey <sje at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Priority|P1                          |P5
                 CC|                            |sje at gcc dot gnu.org


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

* [Bug middle-end/53476] [4.8 Regression] FAIL: gcc.dg/attr-weakref-1.c
  2012-05-24 14:32 [Bug middle-end/53476] New: [4.8 Regression] FAIL: gcc.dg/attr-weakref-1.c hjl.tools at gmail dot com
                   ` (6 preceding siblings ...)
  2012-09-26 21:58 ` sje at gcc dot gnu.org
@ 2012-09-26 22:04 ` sje at gcc dot gnu.org
  2012-12-13 13:50 ` rguenth at gcc dot gnu.org
                   ` (3 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: sje at gcc dot gnu.org @ 2012-09-26 22:04 UTC (permalink / raw)
  To: gcc-bugs


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

Steve Ellcey <sje at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Priority|P5                          |P1

--- Comment #6 from Steve Ellcey <sje at gcc dot gnu.org> 2012-09-26 22:04:12 UTC ---
Woops, I did not intend to change this to P5.


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

* [Bug middle-end/53476] [4.8 Regression] FAIL: gcc.dg/attr-weakref-1.c
  2012-05-24 14:32 [Bug middle-end/53476] New: [4.8 Regression] FAIL: gcc.dg/attr-weakref-1.c hjl.tools at gmail dot com
                   ` (7 preceding siblings ...)
  2012-09-26 22:04 ` sje at gcc dot gnu.org
@ 2012-12-13 13:50 ` rguenth at gcc dot gnu.org
  2012-12-13 15:21 ` rguenth at gcc dot gnu.org
                   ` (2 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: rguenth at gcc dot gnu.org @ 2012-12-13 13:50 UTC (permalink / raw)
  To: gcc-bugs


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

--- Comment #7 from Richard Biener <rguenth at gcc dot gnu.org> 2012-12-13 13:49:47 UTC ---
Reduced testcase:

static int Wv10a __attribute__((weakref ("Wv10b")));
static int Wv10b __attribute__((weakref ("wv10")));
extern int wv10;

extern void abort (void);

int main ()
{
  if (!!&Wv10a)
    abort ();
  return 0;
}

fails to link at -O1 works with -O0.

>From .000i.cgraph:

Reclaiming functions:
Reclaiming variables:
Clearing address taken flags:
Trivially needed variables:
Removing variables: Wv10a

Final Symbol table:

...

Breakpoint 5, varpool_remove_unreferenced_decls ()
    at /space/rguenther/src/svn/trunk/gcc/varpool.c:405
405               varpool_remove_node (node);
(gdb) call debug_symtab_node((symtab_node)node)
Wv10a/0 (Wv10a) @0x7ffff68fa068
  Type: variable
  Visibility: external weak
  References: Wv10b/1 (alias)
  Referring: main/2 (addr)
  Availability: available
  Varpool flags: analyzed finalized

so it's still refered to.

  if (cgraph_dump_file)
    fprintf (cgraph_dump_file, "Trivially needed variables:");
  FOR_EACH_DEFINED_VARIABLE (node)
    {
      if (node->analyzed
          && (!varpool_can_remove_if_no_refs (node)
              /* We just expanded all function bodies.  See if any of
                 them needed the variable.  */
              || (!DECL_EXTERNAL (node->symbol.decl)
                  && DECL_RTL_SET_P (node->symbol.decl))))

doesn't catch it because

(gdb) call debug_tree (node->symbol.decl)
 <var_decl 0x7ffff68045f0 Wv10a
    type <integer_type 0x7ffff67f75e8 int public SI
        size <integer_cst 0x7ffff67fa0c0 constant 32>
        unit size <integer_cst 0x7ffff67fa0e0 constant 4>
        align 32 symtab 0 alias set -1 canonical type 0x7ffff67f75e8 precision
32 min <integer_cst 0x7ffff67fa060 -2147483648> max <integer_cst 0x7ffff67fa080
2147483647>
        pointer_to_this <pointer_type 0x7ffff67ff2a0>>
    addressable used static external weak SI file t.c line 1 col 12 size
<integer_cst 0x7ffff67fa0c0 32> unit size <integer_cst 0x7ffff67fa0e0 4>
    align 32 context <translation_unit_decl 0x7ffff6918000 D.1721> attributes
<tree_list 0x7ffff68f3c08>
    (mem:SI (symbol_ref/i:DI ("Wv10a") <var_decl 0x7ffff68045f0 Wv10a>) [0
Wv10a+0 S4 A32]) chain <var_decl 0x7ffff6804688 Wv10b>>

it has DECL_EXTERNAL set (but it also is TREE_STATIC and has RTL!).
On the 4.7 branch we simply checked whether the DECL had RTL but didn't bother
to check whether it does not have DECL_EXTERNAL set.

I'd say either revert to 4.7 behavior here or do

Index: varpool.c
===================================================================
--- varpool.c   (revision 194472)
+++ varpool.c   (working copy)
@@ -358,7 +358,8 @@ varpool_remove_unreferenced_decls (void)
          && (!varpool_can_remove_if_no_refs (node)
              /* We just expanded all function bodies.  See if any of
                 them needed the variable.  */
-             || (!DECL_EXTERNAL (node->symbol.decl)
+             || (!(DECL_EXTERNAL (node->symbol.decl)
+                   && !TREE_STATIC (node->symbol.decl))
                  && DECL_RTL_SET_P (node->symbol.decl))))
        {
          enqueue_node (node, &first);

testing reversal to 4.7 behavior.


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

* [Bug middle-end/53476] [4.8 Regression] FAIL: gcc.dg/attr-weakref-1.c
  2012-05-24 14:32 [Bug middle-end/53476] New: [4.8 Regression] FAIL: gcc.dg/attr-weakref-1.c hjl.tools at gmail dot com
                   ` (8 preceding siblings ...)
  2012-12-13 13:50 ` rguenth at gcc dot gnu.org
@ 2012-12-13 15:21 ` rguenth at gcc dot gnu.org
  2012-12-13 15:22 ` rguenth at gcc dot gnu.org
  2012-12-13 20:56 ` hubicka at ucw dot cz
  11 siblings, 0 replies; 13+ messages in thread
From: rguenth at gcc dot gnu.org @ 2012-12-13 15:21 UTC (permalink / raw)
  To: gcc-bugs


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

--- Comment #8 from Richard Biener <rguenth at gcc dot gnu.org> 2012-12-13 15:21:05 UTC ---
Author: rguenth
Date: Thu Dec 13 15:20:57 2012
New Revision: 194481

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=194481
Log:
2012-12-13  Richard Biener  <rguenther@suse.de>

    PR middle-end/53476
    * varpool.c (varpool_remove_unreferenced_decls): Revert to 4.7
    behavior.

Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/varpool.c


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

* [Bug middle-end/53476] [4.8 Regression] FAIL: gcc.dg/attr-weakref-1.c
  2012-05-24 14:32 [Bug middle-end/53476] New: [4.8 Regression] FAIL: gcc.dg/attr-weakref-1.c hjl.tools at gmail dot com
                   ` (9 preceding siblings ...)
  2012-12-13 15:21 ` rguenth at gcc dot gnu.org
@ 2012-12-13 15:22 ` rguenth at gcc dot gnu.org
  2012-12-13 20:56 ` hubicka at ucw dot cz
  11 siblings, 0 replies; 13+ messages in thread
From: rguenth at gcc dot gnu.org @ 2012-12-13 15:22 UTC (permalink / raw)
  To: gcc-bugs


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

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

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

--- Comment #9 from Richard Biener <rguenth at gcc dot gnu.org> 2012-12-13 15:21:39 UTC ---
Fixed.


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

* [Bug middle-end/53476] [4.8 Regression] FAIL: gcc.dg/attr-weakref-1.c
  2012-05-24 14:32 [Bug middle-end/53476] New: [4.8 Regression] FAIL: gcc.dg/attr-weakref-1.c hjl.tools at gmail dot com
                   ` (10 preceding siblings ...)
  2012-12-13 15:22 ` rguenth at gcc dot gnu.org
@ 2012-12-13 20:56 ` hubicka at ucw dot cz
  11 siblings, 0 replies; 13+ messages in thread
From: hubicka at ucw dot cz @ 2012-12-13 20:56 UTC (permalink / raw)
  To: gcc-bugs


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

--- Comment #10 from Jan Hubicka <hubicka at ucw dot cz> 2012-12-13 20:56:13 UTC ---
> (gdb) call debug_tree (node->symbol.decl)
>  <var_decl 0x7ffff68045f0 Wv10a
>     type <integer_type 0x7ffff67f75e8 int public SI
>         size <integer_cst 0x7ffff67fa0c0 constant 32>
>         unit size <integer_cst 0x7ffff67fa0e0 constant 4>
>         align 32 symtab 0 alias set -1 canonical type 0x7ffff67f75e8 precision
> 32 min <integer_cst 0x7ffff67fa060 -2147483648> max <integer_cst 0x7ffff67fa080
> 2147483647>
>         pointer_to_this <pointer_type 0x7ffff67ff2a0>>
>     addressable used static external weak SI file t.c line 1 col 12 size
> <integer_cst 0x7ffff67fa0c0 32> unit size <integer_cst 0x7ffff67fa0e0 4>
>     align 32 context <translation_unit_decl 0x7ffff6918000 D.1721> attributes
> <tree_list 0x7ffff68f3c08>
>     (mem:SI (symbol_ref/i:DI ("Wv10a") <var_decl 0x7ffff68045f0 Wv10a>) [0
> Wv10a+0 S4 A32]) chain <var_decl 0x7ffff6804688 Wv10b>>
> 
> it has DECL_EXTERNAL set (but it also is TREE_STATIC and has RTL!).
> On the 4.7 branch we simply checked whether the DECL had RTL but didn't bother
> to check whether it does not have DECL_EXTERNAL set.
> 
> I'd say either revert to 4.7 behavior here or do
> 
> Index: varpool.c
> ===================================================================
> --- varpool.c   (revision 194472)
> +++ varpool.c   (working copy)
> @@ -358,7 +358,8 @@ varpool_remove_unreferenced_decls (void)
>           && (!varpool_can_remove_if_no_refs (node)
>               /* We just expanded all function bodies.  See if any of
>                  them needed the variable.  */
> -             || (!DECL_EXTERNAL (node->symbol.decl)
> +             || (!(DECL_EXTERNAL (node->symbol.decl)
> +                   && !TREE_STATIC (node->symbol.decl))

Oops, thanks! I had similar hunk sitting in my tree for a while, but forgot to
commit it.

The point of nor marking extenral as used at this point was to release memory
used by identifiers because at this stage they do not matter, but since we gave
up on that, I guess this is fine.

For 4.9 I think I should look into reorganizing weakrefs to have different
tree representation. This abuse of external flag is really anoying.

Honza


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

end of thread, other threads:[~2012-12-13 20:56 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-05-24 14:32 [Bug middle-end/53476] New: [4.8 Regression] FAIL: gcc.dg/attr-weakref-1.c hjl.tools at gmail dot com
2012-05-24 15:33 ` [Bug middle-end/53476] " hjl.tools at gmail dot com
2012-05-24 17:57 ` hp at gcc dot gnu.org
2012-05-28 15:17 ` Greta.Yorsh at arm dot com
2012-05-29 12:07 ` hubicka at gcc dot gnu.org
2012-05-29 13:26 ` ro at gcc dot gnu.org
2012-09-07 12:06 ` rguenth at gcc dot gnu.org
2012-09-26 21:58 ` sje at gcc dot gnu.org
2012-09-26 22:04 ` sje at gcc dot gnu.org
2012-12-13 13:50 ` rguenth at gcc dot gnu.org
2012-12-13 15:21 ` rguenth at gcc dot gnu.org
2012-12-13 15:22 ` rguenth at gcc dot gnu.org
2012-12-13 20:56 ` hubicka at ucw dot cz

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).