public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug libstdc++/51845] New: [4.6 regression] 23_containers/unordered_multimap/erase/24061-multimap.cc segfault
@ 2012-01-13  9:29 krebbel at gcc dot gnu.org
  2012-01-13  9:53 ` [Bug libstdc++/51845] [4.7 " rguenth at gcc dot gnu.org
                   ` (20 more replies)
  0 siblings, 21 replies; 22+ messages in thread
From: krebbel at gcc dot gnu.org @ 2012-01-13  9:29 UTC (permalink / raw)
  To: gcc-bugs

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

             Bug #: 51845
           Summary: [4.6 regression]
                    23_containers/unordered_multimap/erase/24061-multimap.
                    cc segfault
    Classification: Unclassified
           Product: gcc
           Version: 4.7.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: libstdc++
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: krebbel@gcc.gnu.org


The failure has been introduced between revisions r181648 r181683.


gdb --args ./24061-multimap.exe 
GNU gdb (GDB) Fedora (7.2.50.20110206-18.fc13)
Copyright (C) 2011 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
and "show warranty" for details.
This GDB was configured as "s390-redhat-linux-gnu".
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>...
Reading symbols from
/build/gcc-head-build/s390-ibm-linux-gnu/libstdc++-v3/testsuite/24061-multimap.exe...done.
(gdb) r
Starting program:
/build/gcc-head-build/s390-ibm-linux-gnu/libstdc++-v3/testsuite/24061-multimap.exe 

Program received signal SIGSEGV, Segmentation fault.
malloc_consolidate (av=0x77e123c8) at malloc.c:5161
5161    malloc.c: No such file or directory.
        in malloc.c
(gdb) bt
#0  malloc_consolidate (av=0x77e123c8) at malloc.c:5161
#1  0x77d0ba7e in _int_free (av=0x77e123c8, p=0x4044d0, have_lock=1) at
malloc.c:5034
#2  0x77d0e4da in _int_realloc (av=0x77e123c8, oldp=0x404420,
oldsize=<optimized out>, nb=<optimized out>)
    at malloc.c:5367
#3  0x77d0e7f4 in __libc_realloc (oldmem=0x404428, bytes=172) at malloc.c:3821
#4  0x77d027d0 in _IO_vasprintf (result_ptr=0x7fffea3c, format=<optimized out>,
args=0x7fffe9b8) at vasprintf.c:86
#5  0x77ce49a4 in ___asprintf (string_ptr=<optimized out>, format=<optimized
out>) at asprintf.c:37
#6  0x77cbbbe8 in __assert_fail (assertion=0x4025d2 "mm1.size() == 0", 
    file=0x4024fc
"/build/gcc-head/libstdc++-v3/testsuite/23_containers/unordered_multimap/erase/24061-multimap.cc",
line=99, function=<optimized out>) at assert.c:63
#7  0x00401ff2 in test01 ()
    at
/build/gcc-head/libstdc++-v3/testsuite/23_containers/unordered_multimap/erase/24061-multimap.cc:99
#8  0x004009fe in main ()
    at
/build/gcc-head/libstdc++-v3/testsuite/23_containers/unordered_multimap/erase/24061-multimap.cc:106


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

* [Bug libstdc++/51845] [4.7 regression] 23_containers/unordered_multimap/erase/24061-multimap.cc segfault
  2012-01-13  9:29 [Bug libstdc++/51845] New: [4.6 regression] 23_containers/unordered_multimap/erase/24061-multimap.cc segfault krebbel at gcc dot gnu.org
@ 2012-01-13  9:53 ` rguenth at gcc dot gnu.org
  2012-01-13 10:57 ` paolo.carlini at oracle dot com
                   ` (19 subsequent siblings)
  20 siblings, 0 replies; 22+ messages in thread
From: rguenth at gcc dot gnu.org @ 2012-01-13  9:53 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|---                         |4.7.0
            Summary|[4.6 regression]            |[4.7 regression]
                   |23_containers/unordered_mul |23_containers/unordered_mul
                   |timap/erase/24061-multimap. |timap/erase/24061-multimap.
                   |cc segfault                 |cc segfault

--- Comment #1 from Richard Guenther <rguenth at gcc dot gnu.org> 2012-01-13 09:51:15 UTC ---
4.7 regression I suppose.


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

* [Bug libstdc++/51845] [4.7 regression] 23_containers/unordered_multimap/erase/24061-multimap.cc segfault
  2012-01-13  9:29 [Bug libstdc++/51845] New: [4.6 regression] 23_containers/unordered_multimap/erase/24061-multimap.cc segfault krebbel at gcc dot gnu.org
  2012-01-13  9:53 ` [Bug libstdc++/51845] [4.7 " rguenth at gcc dot gnu.org
@ 2012-01-13 10:57 ` paolo.carlini at oracle dot com
  2012-01-13 11:44 ` dominiq at lps dot ens.fr
                   ` (18 subsequent siblings)
  20 siblings, 0 replies; 22+ messages in thread
From: paolo.carlini at oracle dot com @ 2012-01-13 10:57 UTC (permalink / raw)
  To: gcc-bugs

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

Paolo Carlini <paolo.carlini at oracle dot com> changed:

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

--- Comment #2 from Paolo Carlini <paolo.carlini at oracle dot com> 2012-01-13 10:54:38 UTC ---
Assuming the issue persists also post the last tweaks to the design which
Francois is about to commit, this is a P1, in my opinion.

Francois, in case you haven't done it already, I would recommend in any case
running a good part of the testsuite under valgrind (on x86/x86_64 or
whatelse).

By the way, looks like valgrind is now available under s390/linux too, maybe
Andreas can add info about it...


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

* [Bug libstdc++/51845] [4.7 regression] 23_containers/unordered_multimap/erase/24061-multimap.cc segfault
  2012-01-13  9:29 [Bug libstdc++/51845] New: [4.6 regression] 23_containers/unordered_multimap/erase/24061-multimap.cc segfault krebbel at gcc dot gnu.org
  2012-01-13  9:53 ` [Bug libstdc++/51845] [4.7 " rguenth at gcc dot gnu.org
  2012-01-13 10:57 ` paolo.carlini at oracle dot com
@ 2012-01-13 11:44 ` dominiq at lps dot ens.fr
  2012-01-13 12:43 ` krebbel at gcc dot gnu.org
                   ` (17 subsequent siblings)
  20 siblings, 0 replies; 22+ messages in thread
From: dominiq at lps dot ens.fr @ 2012-01-13 11:44 UTC (permalink / raw)
  To: gcc-bugs

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

Dominique d'Humieres <dominiq at lps dot ens.fr> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2012-01-13
     Ever Confirmed|0                           |1

--- Comment #3 from Dominique d'Humieres <dominiq at lps dot ens.fr> 2012-01-13 11:37:32 UTC ---
I also see this pr on powerpc-apple-darwin9 with -m32 (but not with -m64).


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

* [Bug libstdc++/51845] [4.7 regression] 23_containers/unordered_multimap/erase/24061-multimap.cc segfault
  2012-01-13  9:29 [Bug libstdc++/51845] New: [4.6 regression] 23_containers/unordered_multimap/erase/24061-multimap.cc segfault krebbel at gcc dot gnu.org
                   ` (2 preceding siblings ...)
  2012-01-13 11:44 ` dominiq at lps dot ens.fr
@ 2012-01-13 12:43 ` krebbel at gcc dot gnu.org
  2012-01-13 12:45 ` krebbel at gcc dot gnu.org
                   ` (16 subsequent siblings)
  20 siblings, 0 replies; 22+ messages in thread
From: krebbel at gcc dot gnu.org @ 2012-01-13 12:43 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #4 from Andreas Krebbel <krebbel at gcc dot gnu.org> 2012-01-13 12:41:55 UTC ---
For s390 the first failing release was r181677.


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

* [Bug libstdc++/51845] [4.7 regression] 23_containers/unordered_multimap/erase/24061-multimap.cc segfault
  2012-01-13  9:29 [Bug libstdc++/51845] New: [4.6 regression] 23_containers/unordered_multimap/erase/24061-multimap.cc segfault krebbel at gcc dot gnu.org
                   ` (3 preceding siblings ...)
  2012-01-13 12:43 ` krebbel at gcc dot gnu.org
@ 2012-01-13 12:45 ` krebbel at gcc dot gnu.org
  2012-01-13 12:57 ` paolo.carlini at oracle dot com
                   ` (15 subsequent siblings)
  20 siblings, 0 replies; 22+ messages in thread
From: krebbel at gcc dot gnu.org @ 2012-01-13 12:45 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #5 from Andreas Krebbel <krebbel at gcc dot gnu.org> 2012-01-13 12:42:42 UTC ---
Yes Valgrind has S/390 support since release 3.7.0.


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

* [Bug libstdc++/51845] [4.7 regression] 23_containers/unordered_multimap/erase/24061-multimap.cc segfault
  2012-01-13  9:29 [Bug libstdc++/51845] New: [4.6 regression] 23_containers/unordered_multimap/erase/24061-multimap.cc segfault krebbel at gcc dot gnu.org
                   ` (4 preceding siblings ...)
  2012-01-13 12:45 ` krebbel at gcc dot gnu.org
@ 2012-01-13 12:57 ` paolo.carlini at oracle dot com
  2012-01-13 13:40 ` krebbel at gcc dot gnu.org
                   ` (14 subsequent siblings)
  20 siblings, 0 replies; 22+ messages in thread
From: paolo.carlini at oracle dot com @ 2012-01-13 12:57 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #6 from Paolo Carlini <paolo.carlini at oracle dot com> 2012-01-13 12:56:03 UTC ---
Andreas, can you run the test under valgrind? Thanks in advance.


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

* [Bug libstdc++/51845] [4.7 regression] 23_containers/unordered_multimap/erase/24061-multimap.cc segfault
  2012-01-13  9:29 [Bug libstdc++/51845] New: [4.6 regression] 23_containers/unordered_multimap/erase/24061-multimap.cc segfault krebbel at gcc dot gnu.org
                   ` (5 preceding siblings ...)
  2012-01-13 12:57 ` paolo.carlini at oracle dot com
@ 2012-01-13 13:40 ` krebbel at gcc dot gnu.org
  2012-01-13 17:27 ` jakub at gcc dot gnu.org
                   ` (13 subsequent siblings)
  20 siblings, 0 replies; 22+ messages in thread
From: krebbel at gcc dot gnu.org @ 2012-01-13 13:40 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #7 from Andreas Krebbel <krebbel at gcc dot gnu.org> 2012-01-13 13:07:52 UTC ---
(In reply to comment #6)
> Andreas, can you run the test under valgrind? Thanks in advance.

I should better have mentioned that Valgrind on S/390 doesn't support 32 bit
code yet :(
So no, Valgrind unfortunately is no option.


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

* [Bug libstdc++/51845] [4.7 regression] 23_containers/unordered_multimap/erase/24061-multimap.cc segfault
  2012-01-13  9:29 [Bug libstdc++/51845] New: [4.6 regression] 23_containers/unordered_multimap/erase/24061-multimap.cc segfault krebbel at gcc dot gnu.org
                   ` (6 preceding siblings ...)
  2012-01-13 13:40 ` krebbel at gcc dot gnu.org
@ 2012-01-13 17:27 ` jakub at gcc dot gnu.org
  2012-01-13 20:37 ` pinskia at gcc dot gnu.org
                   ` (12 subsequent siblings)
  20 siblings, 0 replies; 22+ messages in thread
From: jakub at gcc dot gnu.org @ 2012-01-13 17:27 UTC (permalink / raw)
  To: gcc-bugs

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

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

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

--- Comment #8 from Jakub Jelinek <jakub at gcc dot gnu.org> 2012-01-13 17:04:37 UTC ---
But ElectricFence should work even on s390 31-bit.  Can you please try that?


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

* [Bug libstdc++/51845] [4.7 regression] 23_containers/unordered_multimap/erase/24061-multimap.cc segfault
  2012-01-13  9:29 [Bug libstdc++/51845] New: [4.6 regression] 23_containers/unordered_multimap/erase/24061-multimap.cc segfault krebbel at gcc dot gnu.org
                   ` (7 preceding siblings ...)
  2012-01-13 17:27 ` jakub at gcc dot gnu.org
@ 2012-01-13 20:37 ` pinskia at gcc dot gnu.org
  2012-01-13 23:01 ` ebotcazou at gcc dot gnu.org
                   ` (11 subsequent siblings)
  20 siblings, 0 replies; 22+ messages in thread
From: pinskia at gcc dot gnu.org @ 2012-01-13 20:37 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |wrong-code
             Target|                            |mips64-linux-gnu and
                   |                            |s390-linux-gnu

--- Comment #9 from Andrew Pinski <pinskia at gcc dot gnu.org> 2012-01-13 20:25:19 UTC ---
It also fails for mips64 with the N32 ABI:
http://gcc.gnu.org/ml/gcc-testresults/2012-01/msg01203.html

And valgrind is not supported on mips64 yet either.


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

* [Bug libstdc++/51845] [4.7 regression] 23_containers/unordered_multimap/erase/24061-multimap.cc segfault
  2012-01-13  9:29 [Bug libstdc++/51845] New: [4.6 regression] 23_containers/unordered_multimap/erase/24061-multimap.cc segfault krebbel at gcc dot gnu.org
                   ` (8 preceding siblings ...)
  2012-01-13 20:37 ` pinskia at gcc dot gnu.org
@ 2012-01-13 23:01 ` ebotcazou at gcc dot gnu.org
  2012-01-15 14:05 ` schwab@linux-m68k.org
                   ` (10 subsequent siblings)
  20 siblings, 0 replies; 22+ messages in thread
From: ebotcazou at gcc dot gnu.org @ 2012-01-13 23:01 UTC (permalink / raw)
  To: gcc-bugs

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

Eric Botcazou <ebotcazou at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Target|mips64-linux-gnu and        |mips64-*-* s390-linux-gnu
                   |s390-linux-gnu              |
                 CC|                            |ebotcazou at gcc dot
                   |                            |gnu.org

--- Comment #10 from Eric Botcazou <ebotcazou at gcc dot gnu.org> 2012-01-13 22:29:15 UTC ---
That's also the only failure on SPARC/Solaris 32-bit.  64-bit is unaffected.


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

* [Bug libstdc++/51845] [4.7 regression] 23_containers/unordered_multimap/erase/24061-multimap.cc segfault
  2012-01-13  9:29 [Bug libstdc++/51845] New: [4.6 regression] 23_containers/unordered_multimap/erase/24061-multimap.cc segfault krebbel at gcc dot gnu.org
                   ` (9 preceding siblings ...)
  2012-01-13 23:01 ` ebotcazou at gcc dot gnu.org
@ 2012-01-15 14:05 ` schwab@linux-m68k.org
  2012-01-15 17:22 ` krebbel at gcc dot gnu.org
                   ` (9 subsequent siblings)
  20 siblings, 0 replies; 22+ messages in thread
From: schwab@linux-m68k.org @ 2012-01-15 14:05 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #11 from Andreas Schwab <schwab@linux-m68k.org> 2012-01-15 13:36:39 UTC ---
Created attachment 26332
  --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=26332
valgrind log

$ valgrind  --log-file=log ./24061-multimap.exe
24061-multimap.exe:
/daten/gcc/gcc-20120113/libstdc++-v3/testsuite/23_containers/unordered_multimap/erase/24061-multimap.cc:99:
void test01(): Assertion `mm1.size() == 0' failed.
Aborted


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

* [Bug libstdc++/51845] [4.7 regression] 23_containers/unordered_multimap/erase/24061-multimap.cc segfault
  2012-01-13  9:29 [Bug libstdc++/51845] New: [4.6 regression] 23_containers/unordered_multimap/erase/24061-multimap.cc segfault krebbel at gcc dot gnu.org
                   ` (10 preceding siblings ...)
  2012-01-15 14:05 ` schwab@linux-m68k.org
@ 2012-01-15 17:22 ` krebbel at gcc dot gnu.org
  2012-01-15 21:47 ` fdumont at gcc dot gnu.org
                   ` (8 subsequent siblings)
  20 siblings, 0 replies; 22+ messages in thread
From: krebbel at gcc dot gnu.org @ 2012-01-15 17:22 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #12 from Andreas Krebbel <krebbel at gcc dot gnu.org> 2012-01-15 17:00:42 UTC ---
(In reply to comment #8)
> But ElectricFence should work even on s390 31-bit.  Can you please try that?

I've linked libstdc++ against electric fence. The segfault appears to get
triggered somewhere else then.

gdb ./24061-multimap.exe 
GNU gdb (GDB) Fedora (7.2.50.20110206-18.fc13)
Copyright (C) 2011 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
and "show warranty" for details.
This GDB was configured as "s390-redhat-linux-gnu".
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>...
Reading symbols from
/build/gcc-headnew-build/s390-ibm-linux-gnu/libstdc++-v3/testsuite/24061-multimap.exe...done.
(gdb) r
Starting program:
/build/gcc-headnew-build/s390-ibm-linux-gnu/libstdc++-v3/testsuite/24061-multimap.exe 
[Thread debugging using libthread_db enabled]

  Electric Fence 2.1 Copyright (C) 1987-1998 Bruce Perens.

Program received signal SIGSEGV, Segmentation fault.
_M_get_previous_node (__n=0x77b95ff0, __bkt=10, this=<optimized out>)
    at
/build/gcc-headnew-build/s390-ibm-linux-gnu/libstdc++-v3/include/bits/hashtable.h:1175
1175              while (__prev_n->_M_next != __n)
(gdb) bt
#0  _M_get_previous_node (__n=0x77b95ff0, __bkt=10, this=<optimized out>)
    at
/build/gcc-headnew-build/s390-ibm-linux-gnu/libstdc++-v3/include/bits/hashtable.h:1175
#1  std::_Hashtable<std::basic_string<char, std::char_traits<char>,
std::allocator<char> >, std::pair<std::basic_string<char,
std::char_traits<char>, std::allocator<char> > const, int>,
std::allocator<std::pair<std::basic_string<char, std::char_traits<char>,
std::allocator<char> > const, int> >,
std::_Select1st<std::pair<std::basic_string<char, std::char_traits<char>,
std::allocator<char> > const, int> >, std::equal_to<std::basic_string<char,
std::char_traits<char>, std::allocator<char> > >,
std::hash<std::basic_string<char, std::char_traits<char>, std::allocator<char>
> >, std::__detail::_Mod_range_hashing, std::__detail::_Default_ranged_hash,
std::__detail::_Prime_rehash_policy, true, false, false>::erase
(this=0x7fffec14, __it=...)
    at
/build/gcc-headnew-build/s390-ibm-linux-gnu/libstdc++-v3/include/bits/hashtable.h:1363
#2  0x0040244c in test01 ()
    at
/build/gcc-headnew/libstdc++-v3/testsuite/23_containers/unordered_multimap/erase/24061-multimap.cc:81
#3  0x00400a14 in main ()
    at
/build/gcc-headnew/libstdc++-v3/testsuite/23_containers/unordered_multimap/erase/24061-multimap.cc:106
(gdb)


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

* [Bug libstdc++/51845] [4.7 regression] 23_containers/unordered_multimap/erase/24061-multimap.cc segfault
  2012-01-13  9:29 [Bug libstdc++/51845] New: [4.6 regression] 23_containers/unordered_multimap/erase/24061-multimap.cc segfault krebbel at gcc dot gnu.org
                   ` (11 preceding siblings ...)
  2012-01-15 17:22 ` krebbel at gcc dot gnu.org
@ 2012-01-15 21:47 ` fdumont at gcc dot gnu.org
  2012-01-15 22:42 ` schwab@linux-m68k.org
                   ` (7 subsequent siblings)
  20 siblings, 0 replies; 22+ messages in thread
From: fdumont at gcc dot gnu.org @ 2012-01-15 21:47 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #13 from François Dumont <fdumont at gcc dot gnu.org> 2012-01-15 21:13:59 UTC ---
I will have a try with Valgrin but line numbers in the comments here do not
seem to all match the latest hashtable code commited on trunk in revision
183164. This last commit really simplify the code and made the data model more
consistent, it might have fix something. If you could have a try with this
version it would help.

Thanks


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

* [Bug libstdc++/51845] [4.7 regression] 23_containers/unordered_multimap/erase/24061-multimap.cc segfault
  2012-01-13  9:29 [Bug libstdc++/51845] New: [4.6 regression] 23_containers/unordered_multimap/erase/24061-multimap.cc segfault krebbel at gcc dot gnu.org
                   ` (12 preceding siblings ...)
  2012-01-15 21:47 ` fdumont at gcc dot gnu.org
@ 2012-01-15 22:42 ` schwab@linux-m68k.org
  2012-01-15 23:17 ` dominiq at lps dot ens.fr
                   ` (6 subsequent siblings)
  20 siblings, 0 replies; 22+ messages in thread
From: schwab@linux-m68k.org @ 2012-01-15 22:42 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #14 from Andreas Schwab <schwab@linux-m68k.org> 2012-01-15 21:23:06 UTC ---
The valgrind log refers to the latest version.


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

* [Bug libstdc++/51845] [4.7 regression] 23_containers/unordered_multimap/erase/24061-multimap.cc segfault
  2012-01-13  9:29 [Bug libstdc++/51845] New: [4.6 regression] 23_containers/unordered_multimap/erase/24061-multimap.cc segfault krebbel at gcc dot gnu.org
                   ` (13 preceding siblings ...)
  2012-01-15 22:42 ` schwab@linux-m68k.org
@ 2012-01-15 23:17 ` dominiq at lps dot ens.fr
  2012-01-16  0:07 ` paolo.carlini at oracle dot com
                   ` (5 subsequent siblings)
  20 siblings, 0 replies; 22+ messages in thread
From: dominiq at lps dot ens.fr @ 2012-01-15 23:17 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #15 from Dominique d'Humieres <dominiq at lps dot ens.fr> 2012-01-15 21:46:37 UTC ---
Between revisions 183030 and 183181,
23_containers/unordered_multiset/erase/24061-multiset.cc has also started to
fail in a similar manner (see
http://gcc.gnu.org/ml/gcc-testresults/2012-01/msg01438.html ):

[karma] libstdc++-v3/testsuite% ./24061-multiset.exe
Assertion failed: (get_nb_bucket_elems(ms1) == ms1.size()), function test01,
file
/opt/gcc/work/libstdc++-v3/testsuite/23_containers/unordered_multiset/erase/24061-multiset.cc,
line 87.
Abort

Should I open another PR for it or is it a kind of duplicate?


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

* [Bug libstdc++/51845] [4.7 regression] 23_containers/unordered_multimap/erase/24061-multimap.cc segfault
  2012-01-13  9:29 [Bug libstdc++/51845] New: [4.6 regression] 23_containers/unordered_multimap/erase/24061-multimap.cc segfault krebbel at gcc dot gnu.org
                   ` (14 preceding siblings ...)
  2012-01-15 23:17 ` dominiq at lps dot ens.fr
@ 2012-01-16  0:07 ` paolo.carlini at oracle dot com
  2012-01-18 19:31 ` jakub at gcc dot gnu.org
                   ` (4 subsequent siblings)
  20 siblings, 0 replies; 22+ messages in thread
From: paolo.carlini at oracle dot com @ 2012-01-16  0:07 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #16 from Paolo Carlini <paolo.carlini at oracle dot com> 2012-01-15 23:18:49 UTC ---
I don't think we need a separate PR, for now.

And, on an unrelated note, I'm pretty sure something should show up relatively
easily under Valgrind too even on x86_64-Linux, even -m64 where the testsuite
is clean, something seems plain wrong with memory use.


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

* [Bug libstdc++/51845] [4.7 regression] 23_containers/unordered_multimap/erase/24061-multimap.cc segfault
  2012-01-13  9:29 [Bug libstdc++/51845] New: [4.6 regression] 23_containers/unordered_multimap/erase/24061-multimap.cc segfault krebbel at gcc dot gnu.org
                   ` (15 preceding siblings ...)
  2012-01-16  0:07 ` paolo.carlini at oracle dot com
@ 2012-01-18 19:31 ` jakub at gcc dot gnu.org
  2012-01-18 21:14 ` fdumont at gcc dot gnu.org
                   ` (3 subsequent siblings)
  20 siblings, 0 replies; 22+ messages in thread
From: jakub at gcc dot gnu.org @ 2012-01-18 19:31 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #17 from Jakub Jelinek <jakub at gcc dot gnu.org> 2012-01-18 18:51:57 UTC ---
I think the bug is in the two argument erase in hashtable.h.
In the testcase we are removing two elements, the last element from bucket 10
and first element from bucket 20, but there is also another element in bucket
20.
This means that __is_bucket_begin is false initially, the last element from
bucket 10 is removed, then __is_bucket_begin is set to true, but as we don't
remove the whole bucket (we stop when __n_bkt == __bkt because we reach
__last_n), the _M_remove_bucket_begin call does nothing.  But as __n_bkt ==
__bkt, we dont' update _M_buckets[__n_bkt], so it references a removed node.

--- libstdc++-v3/include/bits/hashtable.h    2012-01-15 20:59:53.765526939
+0100
+++ libstdc++-v3/include/bits/hashtable.h    2012-01-18 19:49:39.222388730
+0100
@@ -1541,7 +1541,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
       __bkt = __n_bkt;
     }

-      if (__n && __n_bkt != __bkt)
+      if (__n && (__n_bkt != __bkt || __is_bucket_begin))
     _M_buckets[__n_bkt] = __prev_n;
       __prev_n->_M_nxt = __n;
       return iterator(__n);

seems to fix this and I think it should be safe, when __is_bucket_begin is set,
it means __n will be the bucket begin, so _M_buckets[__n_bkt] should be
__prev_n.
The __n_bkt != __bkt test is still needed, for the case where we remove just
the trailing elements of some bucket, then we want to update the next bucket,
even when __is_bucket_begin is false.


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

* [Bug libstdc++/51845] [4.7 regression] 23_containers/unordered_multimap/erase/24061-multimap.cc segfault
  2012-01-13  9:29 [Bug libstdc++/51845] New: [4.6 regression] 23_containers/unordered_multimap/erase/24061-multimap.cc segfault krebbel at gcc dot gnu.org
                   ` (16 preceding siblings ...)
  2012-01-18 19:31 ` jakub at gcc dot gnu.org
@ 2012-01-18 21:14 ` fdumont at gcc dot gnu.org
  2012-01-18 22:01 ` jakub at gcc dot gnu.org
                   ` (2 subsequent siblings)
  20 siblings, 0 replies; 22+ messages in thread
From: fdumont at gcc dot gnu.org @ 2012-01-18 21:14 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #18 from François Dumont <fdumont at gcc dot gnu.org> 2012-01-18 20:44:21 UTC ---
I was about to say that resolution of PR 51866 might also explain the memory
issue of this PR but I am now going to double check your post.

Thanks


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

* [Bug libstdc++/51845] [4.7 regression] 23_containers/unordered_multimap/erase/24061-multimap.cc segfault
  2012-01-13  9:29 [Bug libstdc++/51845] New: [4.6 regression] 23_containers/unordered_multimap/erase/24061-multimap.cc segfault krebbel at gcc dot gnu.org
                   ` (17 preceding siblings ...)
  2012-01-18 21:14 ` fdumont at gcc dot gnu.org
@ 2012-01-18 22:01 ` jakub at gcc dot gnu.org
  2012-01-19 10:51 ` jakub at gcc dot gnu.org
  2012-01-19 11:04 ` jakub at gcc dot gnu.org
  20 siblings, 0 replies; 22+ messages in thread
From: jakub at gcc dot gnu.org @ 2012-01-18 22:01 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #19 from Jakub Jelinek <jakub at gcc dot gnu.org> 2012-01-18 20:52:27 UTC ---
Other alternatives to fix this would be to add
  size_t __prev_bkt = _M_bucket_index(__prev_n);
before the for (;;) loop and change the
  if (__n && __n_bkt != __bkt)
test to
  if (__n && __prev_bkt != __n_bkt)
or remove the
  __is_bucket_begin = true;
line and do instead
  __is_bucket_begin = __n_bkt != __bkt;
before the if (__n == __last_n) test and then test just __n &&
__is_bucket_begin after the for (;;) loop.  But I think the patch I'm
bootstrapping/regtesting right now is cheaper than that.


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

* [Bug libstdc++/51845] [4.7 regression] 23_containers/unordered_multimap/erase/24061-multimap.cc segfault
  2012-01-13  9:29 [Bug libstdc++/51845] New: [4.6 regression] 23_containers/unordered_multimap/erase/24061-multimap.cc segfault krebbel at gcc dot gnu.org
                   ` (18 preceding siblings ...)
  2012-01-18 22:01 ` jakub at gcc dot gnu.org
@ 2012-01-19 10:51 ` jakub at gcc dot gnu.org
  2012-01-19 11:04 ` jakub at gcc dot gnu.org
  20 siblings, 0 replies; 22+ messages in thread
From: jakub at gcc dot gnu.org @ 2012-01-19 10:51 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #20 from Jakub Jelinek <jakub at gcc dot gnu.org> 2012-01-19 10:46:35 UTC ---
Author: jakub
Date: Thu Jan 19 10:46:31 2012
New Revision: 183300

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=183300
Log:
    PR libstdc++/51845
    * include/bits/hashtable.h
    (_Hashtable<>::erase(const_iterator, const_iterator)): Also update
    _M_buckets[__n_bkt] if __is_bucket_begin.

    * testsuite/23_containers/unordered_multimap/erase/51845-multimap.cc:
    New test.

Added:
   
trunk/libstdc++-v3/testsuite/23_containers/unordered_multimap/erase/51845-multimap.cc
Modified:
    trunk/libstdc++-v3/ChangeLog
    trunk/libstdc++-v3/include/bits/hashtable.h


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

* [Bug libstdc++/51845] [4.7 regression] 23_containers/unordered_multimap/erase/24061-multimap.cc segfault
  2012-01-13  9:29 [Bug libstdc++/51845] New: [4.6 regression] 23_containers/unordered_multimap/erase/24061-multimap.cc segfault krebbel at gcc dot gnu.org
                   ` (19 preceding siblings ...)
  2012-01-19 10:51 ` jakub at gcc dot gnu.org
@ 2012-01-19 11:04 ` jakub at gcc dot gnu.org
  20 siblings, 0 replies; 22+ messages in thread
From: jakub at gcc dot gnu.org @ 2012-01-19 11:04 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |FIXED
         AssignedTo|unassigned at gcc dot       |jakub at gcc dot gnu.org
                   |gnu.org                     |

--- Comment #21 from Jakub Jelinek <jakub at gcc dot gnu.org> 2012-01-19 10:54:19 UTC ---
Fixed.


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

end of thread, other threads:[~2012-01-19 10:55 UTC | newest]

Thread overview: 22+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-01-13  9:29 [Bug libstdc++/51845] New: [4.6 regression] 23_containers/unordered_multimap/erase/24061-multimap.cc segfault krebbel at gcc dot gnu.org
2012-01-13  9:53 ` [Bug libstdc++/51845] [4.7 " rguenth at gcc dot gnu.org
2012-01-13 10:57 ` paolo.carlini at oracle dot com
2012-01-13 11:44 ` dominiq at lps dot ens.fr
2012-01-13 12:43 ` krebbel at gcc dot gnu.org
2012-01-13 12:45 ` krebbel at gcc dot gnu.org
2012-01-13 12:57 ` paolo.carlini at oracle dot com
2012-01-13 13:40 ` krebbel at gcc dot gnu.org
2012-01-13 17:27 ` jakub at gcc dot gnu.org
2012-01-13 20:37 ` pinskia at gcc dot gnu.org
2012-01-13 23:01 ` ebotcazou at gcc dot gnu.org
2012-01-15 14:05 ` schwab@linux-m68k.org
2012-01-15 17:22 ` krebbel at gcc dot gnu.org
2012-01-15 21:47 ` fdumont at gcc dot gnu.org
2012-01-15 22:42 ` schwab@linux-m68k.org
2012-01-15 23:17 ` dominiq at lps dot ens.fr
2012-01-16  0:07 ` paolo.carlini at oracle dot com
2012-01-18 19:31 ` jakub at gcc dot gnu.org
2012-01-18 21:14 ` fdumont at gcc dot gnu.org
2012-01-18 22:01 ` jakub at gcc dot gnu.org
2012-01-19 10:51 ` jakub at gcc dot gnu.org
2012-01-19 11:04 ` jakub 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).