Bug 14579 - [tree-ssa regression] [merge?] miscompiles POOMA testcase
Summary: [tree-ssa regression] [merge?] miscompiles POOMA testcase
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: libstdc++ (show other bugs)
Version: tree-ssa
: P2 normal
Target Milestone: tree-ssa
Assignee: Not yet assigned to anyone
URL:
Keywords:
Depends on: 14545
Blocks:
  Show dependency treegraph
 
Reported: 2004-03-15 12:48 UTC by Richard Biener
Modified: 2004-03-28 07:33 UTC (History)
3 users (show)

See Also:
Host: i686-pc-linux-gnu
Target: i686-pc-linux-gnu
Build: i686-pc-linux-gnu
Known to work:
Known to fail:
Last reconfirmed: 2004-03-15 16:56:38


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Richard Biener 2004-03-15 12:48:08 UTC
The tramp3d-v2 testcase (attachment see PR14408) gets miscompiled by tree-ssa.
Compiling with

g++-ssa -O0 -o tramp3d-v2 tramp3d-v2.cpp -Dleafify=fooblah -static

the testcase segfaults on start with gdb backtrace:

(gdb) run
Starting program: /tmp/tramp3d-v2 

Program received signal SIGSEGV, Segmentation fault.
0x0808e345 in __gnu_cxx::__mt_alloc<Loc<1> >::allocate(unsigned, void const*) (
    this=0xbfffe978, __n=0)
    at
/net/bellatrix/home/rguenth/ix86/gccssa-150304/bin/../lib/gcc/i686-pc-linux-gnu/3.5-tree-ssa/../../../../include/c++/3.5-tree-ssa/ext/mt_allocator.h:408
408                       block->next = (block_record*)((char*)block +
(gdb) bt
#0  0x0808e345 in __gnu_cxx::__mt_alloc<Loc<1> >::allocate(unsigned, void const*) (
    this=0xbfffe978, __n=0)
    at
/net/bellatrix/home/rguenth/ix86/gccssa-150304/bin/../lib/gcc/i686-pc-linux-gnu/3.5-tree-ssa/../../../../include/c++/3.5-tree-ssa/ext/mt_allocator.h:408
#1  0x0807db6c in __gnu_norm::_Vector_base<Loc<1>, std::allocator<Loc<1> >
>::_M_allocate(unsigned) (this=0xbfffe978, __n=0)
    at
/net/bellatrix/home/rguenth/ix86/gccssa-150304/bin/../lib/gcc/i686-pc-linux-gnu/3.5-tree-ssa/../../../../include/c++/3.5-tree-ssa/bits/stl_vector.h:106
#2  0x080701fc in _Vector_base (this=0xbfffe978, __n=0, __a=@0xbfffe800)
    at
/net/bellatrix/home/rguenth/ix86/gccssa-150304/bin/../lib/gcc/i686-pc-linux-gnu/3.5-tree-ssa/../../../../include/c++/3.5-tree-ssa/bits/stl_vector.h:91
#3  0x0807c704 in vector (this=0xbfffe978, __n=0)
    at
/net/bellatrix/home/rguenth/ix86/gccssa-150304/bin/../lib/gcc/i686-pc-linux-gnu/3.5-tree-ssa/../../../../include/c++/3.5-tree-ssa/bits/stl_vector.h:202
#4  0x0806e605 in Centering (this=0xbfffe970, cent=CellType, cont=Continuous)
    at tramp3d-v2.cpp:5599
#5  0x08059cad in CanonicalCentering (this=0x8148cc1) at tramp3d-v2.cpp:5817
#6  0x0805673d in __static_initialization_and_destruction_0 (__initialize_p=1, 
    __priority=65535) at tramp3d-v2.cpp:6056
#7  0x08057eb4 in _GLOBAL__I__Z22findLeftCommonEndpointiiiiiiRi () at
tramp3d-v2.cpp:56688
#8  0x081421c5 in __do_global_ctors_aux ()
#9  0x08049459 in _init ()
#10 0x0814213c in __libc_csu_init () at elf-init.c:60
#11 0x4013b88f in __libc_start_main () from /lib/libc.so.6
(gdb) print block
$3 = (block_record *) 0x814affe
(gdb) print *block
Cannot access memory at address 0x814affe


This is a regression from at least (works)
g++ (GCC) 3.5-tree-ssa 20040303 (merged 20040227)

occuring no later than (fails)
g++ (GCC) 3.5-tree-ssa 20040311 (merged 20040307)

(I don't have intermediate versions to check)

and still with (fails)
g++-ssa (GCC) 3.5-tree-ssa 20040315 (merged 20040307)


I don't know if this is really libstdc++ or rather optimization (but -O0), also
I didn't check mainline, but

2004-03-08  Benjamin Kosnik  <bkoz@redhat.com>

        * include/bits/allocator.h: Switch defaults to mt_alloc.

2004-03-06  Benjamin Kosnik  <bkoz@redhat.com>

        * include/ext/mt_allocator.h (_S_initialize): If
        !__GTHREAD_MUTEX_INIT, then initialize _S_thread_freelist_mutex.

2004-03-06  Benjamin Kosnik  <bkoz@redhat.com>

        PR libstdc++/12658
        * src/locale_init.cc (locale::locale): Lock critical regions with
        external mutexes.
        (locale::global): Same. 
        * include/bits/concurrence.h (__glibcxx_mutex_define_initialized):
        Add in once bits for cases without __GTHREAD_MUTEX_INIT.
        (__glibcxx_mutex_lock): Same.

        * config/cpu/generic/atomicity.h: Remove
        _GLIBCXX_NEED_GENERIC_MUTEX, use concurrence.h.
        * src/misc-inst.cc: Move all locking bits out of this file.

        * config/os/hpux/os_defines.h: Remove _GLIBCXX_INST_ATOMICITY_LOCK.
        * src/misc-inst.cc: Same.
        * config/cpu/hppa/atomicity.h: Same.

        * config/linker-map.gnu: Remove types in the signature of atomic
        exports, as they may vary.

look related (so bkoz@ CCed).
Comment 1 Richard Biener 2004-03-15 13:13:55 UTC
Reverting

2004-03-08  Benjamin Kosnik  <bkoz@redhat.com>

        * include/bits/allocator.h: Switch defaults to mt_alloc.

in the branch fixes the problem.  Seems the mt allocator is buggy.
Comment 2 Andrew Pinski 2004-03-15 14:17:06 UTC
Can you try the mainline as the MT allocator has been fixed on the mainline.
Comment 3 Richard Biener 2004-03-15 16:51:36 UTC
Subject: Re:  [tree-ssa regression] miscompiles POOMA
 testcase

On Mon, 15 Mar 2004, pinskia at gcc dot gnu dot org wrote:

>
> ------- Additional Comments From pinskia at gcc dot gnu dot org  2004-03-15 14:17 -------
> Can you try the mainline as the MT allocator has been fixed on the mainline.

I can't because of

bellatrix:/tmp$ ~/ix86/gcc3.5/bin/g++ -O2 -ftime-report -o tramp3d-v2 tramp3d-v2.cpp -fno-exceptions -static
tramp3d-v2.cpp: In member function `typename DT::AskDomain_t
DomainBase<DT>::firsts() const':
tramp3d-v2.cpp:3290: internal compiler error: Segmentation fault
Please submit a full bug report,
with preprocessed source if appropriate.
See <URL:http://gcc.gnu.org/bugs.html> for instructions.

which is PR14545.

Richard.

--
Richard Guenther <richard dot guenther at uni-tuebingen dot de>
WWW: http://www.tat.physik.uni-tuebingen.de/~rguenth/
Comment 4 Andrew Pinski 2004-03-15 16:56:36 UTC
Ok, then this will break anyways when the mainline gets merged into the tree-ssa. So lets just change 
this to NEW for now and wait for PR 14545 to be fixed.
Comment 5 Giovanni Bajo 2004-03-19 14:59:30 UTC
Richard, I just fixed PR 14545. If you pull a new mainline version, you can try 
compiling on mainline which should have the fixed MT allocator.
Comment 6 Richard Biener 2004-03-19 16:01:33 UTC
Subject: Re:  [tree-ssa regression] [merge?] miscompiles
 POOMA testcase

On Fri, 19 Mar 2004, giovannibajo at libero dot it wrote:

>
> ------- Additional Comments From giovannibajo at libero dot it  2004-03-19 14:59 -------
> Richard, I just fixed PR 14545. If you pull a new mainline version, you can try
> compiling on mainline which should have the fixed MT allocator.

Did.  But I can't say if it's fixed, as it seems to use the new_allocator,
not the mt_allocator.  Configuring with

--enable-languages="c,c++" --enable-threads=posix --enable-__cxa_atexit
--disable-checking

Richard.
Comment 7 Paolo Carlini 2004-03-19 16:18:19 UTC
Hi. If you want to experiment with the mt_allocator just pass to configure 
--enable-libstdcxx-allocator=mt
Comment 8 Richard Biener 2004-03-19 16:19:28 UTC
Subject: Re:  [tree-ssa regression] [merge?] miscompiles
 POOMA testcase

On Fri, 19 Mar 2004, pcarlini at suse dot de wrote:

>
> ------- Additional Comments From pcarlini at suse dot de  2004-03-19 16:18 -------
> Hi. If you want to experiment with the mt_allocator just pass to configure
> --enable-libstdcxx-allocator=mt

What's the difference?  Correctness or optimization?

--
Richard Guenther <richard dot guenther at uni-tuebingen dot de>
WWW: http://www.tat.physik.uni-tuebingen.de/~rguenth/
Comment 9 Andrew Pinski 2004-03-19 16:31:05 UTC
The different is that the mt allocator is more suited for threaded apps than the "new" allocator is.  
Suited meaning it is optimized for that case.
Comment 10 Andrew Pinski 2004-03-27 20:35:36 UTC
Does this now work on the tree-ssa after the latested merge?
Comment 11 Richard Biener 2004-03-27 23:15:33 UTC
Subject: Re:  [tree-ssa regression] [merge?] miscompiles
 POOMA testcase

pinskia at gcc dot gnu dot org wrote:
> ------- Additional Comments From pinskia at gcc dot gnu dot org  2004-03-27 20:35 -------
> Does this now work on the tree-ssa after the latested merge?

Yes, thanks.

Richard.
Comment 12 Andrew Pinski 2004-03-28 07:33:02 UTC
Closing as fixed.