public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/19349] New: Valgrind errors compiling libjava c++ sources
@ 2005-01-09 20:38 mark at gcc dot gnu dot org
  2005-01-10 15:35 ` [Bug c++/19349] [4.0 Regression] " pinskia at gcc dot gnu dot org
                   ` (9 more replies)
  0 siblings, 10 replies; 11+ messages in thread
From: mark at gcc dot gnu dot org @ 2005-01-09 20:38 UTC (permalink / raw)
  To: gcc-bugs

When configuring with --enable-checking=assert,misc,tree,gc,rtlflag,valgrind
compilation of some c++ source files in the libjava directory give the following  
invalid reads:

/home/mark/src/gcc-obj/gcc/xgcc -shared-libgcc -B/home/mark/src/gcc-obj/gcc/
-nostdinc++ -L/home/mark/src/gcc-obj/i686-pc-linux-gnu/libstdc++-v3/src
-L/home/mark/src/gcc-obj/i686-pc-linux-gnu/libstdc++-v3/src/.libs
-B/usr/local/gcc40/i686-pc-linux-gnu/bin/
-B/usr/local/gcc40/i686-pc-linux-gnu/lib/ -isystem
/usr/local/gcc40/i686-pc-linux-gnu/include -isystem
/usr/local/gcc40/i686-pc-linux-gnu/sys-include -DHAVE_CONFIG_H -I.
-I../../../gcc/libjava -I./include -I./gcj -I../../../gcc/libjava -Iinclude
-I../../../gcc/libjava/include -I../../../gcc/libjava/../boehm-gc/include
-I../boehm-gc/include -I../../../gcc/libjava/libltdl
-I../../../gcc/libjava/libltdl -I../../../gcc/libjava/.././libjava/../gcc
-I../../../gcc/libjava/../zlib -I../../../gcc/libjava/../libffi/include
-I../libffi/include -O2 -g -O2 -fno-rtti -fnon-call-exceptions
-fdollars-in-identifiers -Wswitch-enum -D_FILE_OFFSET_BITS=64 -ffloat-store
-fno-omit-frame-pointer -I/usr/X11R6/include -Wextra -Wall -D_GNU_SOURCE
-DPREFIX=\"/usr/local/gcc40\" -DLIBDIR=\"/usr/local/gcc40/lib\"
-DBOOT_CLASS_PATH=\"/usr/local/gcc40/share/java/libgcj-4.0.0.jar\"
-DJAVA_EXT_DIRS=\"/usr/local/gcc40/share/java/ext\" -g -O2 -D_GNU_SOURCE -MT
prims.lo -MD -MP -MF .deps/prims.Tpo -c ../../../gcc/libjava/prims.cc  -fPIC
-DPIC -o .libs/prims.o
==28413== Invalid read of size 1
==28413==    at 0x814DA3B: pushdecl_namespace_level (name-lookup.c:3027)
==28413==    by 0x81188C5: do_friend (friend.c:546)
==28413==    by 0x8072546: grokdeclarator (decl.c:8084)
==28413==    by 0x80D07D4: grokfield (decl2.c:845)
==28413==  Address 0x1C32087C is not stack'd, malloc'd or (recently) free'd

-- 
           Summary: Valgrind errors compiling libjava c++ sources
           Product: gcc
           Version: 4.0.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: mark at gcc dot gnu dot org
                CC: gcc-bugs at gcc dot gnu dot org


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


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

* [Bug c++/19349] [4.0 Regression] Valgrind errors compiling libjava c++ sources
  2005-01-09 20:38 [Bug c++/19349] New: Valgrind errors compiling libjava c++ sources mark at gcc dot gnu dot org
@ 2005-01-10 15:35 ` pinskia at gcc dot gnu dot org
  2005-01-10 15:35 ` [Bug c++/19349] " pinskia at gcc dot gnu dot org
                   ` (8 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-01-10 15:35 UTC (permalink / raw)
  To: gcc-bugs



-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
            Summary|Valgrind errors compiling   |[4.0 Regression] Valgrind
                   |libjava c++ sources         |errors compiling libjava c++
                   |                            |sources


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


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

* [Bug c++/19349] Valgrind errors compiling libjava c++ sources
  2005-01-09 20:38 [Bug c++/19349] New: Valgrind errors compiling libjava c++ sources mark at gcc dot gnu dot org
  2005-01-10 15:35 ` [Bug c++/19349] [4.0 Regression] " pinskia at gcc dot gnu dot org
@ 2005-01-10 15:35 ` pinskia at gcc dot gnu dot org
  2005-01-17 21:23 ` [Bug c++/19349] [4.0 Regression] " jakub at gcc dot gnu dot org
                   ` (7 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-01-10 15:35 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2005-01-10 15:35 -------
I think this is a regression.

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|---                         |4.0.0


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


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

* [Bug c++/19349] [4.0 Regression] Valgrind errors compiling libjava c++ sources
  2005-01-09 20:38 [Bug c++/19349] New: Valgrind errors compiling libjava c++ sources mark at gcc dot gnu dot org
  2005-01-10 15:35 ` [Bug c++/19349] [4.0 Regression] " pinskia at gcc dot gnu dot org
  2005-01-10 15:35 ` [Bug c++/19349] " pinskia at gcc dot gnu dot org
@ 2005-01-17 21:23 ` jakub at gcc dot gnu dot org
  2005-01-17 23:18 ` pinskia at gcc dot gnu dot org
                   ` (6 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: jakub at gcc dot gnu dot org @ 2005-01-17 21:23 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From jakub at gcc dot gnu dot org  2005-01-17 21:23 -------
Smaller testcase that triggers this is:
void foo ();

namespace N
{
  struct S;
}

struct N::S
{
  S ();
  friend void ::foo ();
};


-- 


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


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

* [Bug c++/19349] [4.0 Regression] Valgrind errors compiling libjava c++ sources
  2005-01-09 20:38 [Bug c++/19349] New: Valgrind errors compiling libjava c++ sources mark at gcc dot gnu dot org
                   ` (2 preceding siblings ...)
  2005-01-17 21:23 ` [Bug c++/19349] [4.0 Regression] " jakub at gcc dot gnu dot org
@ 2005-01-17 23:18 ` pinskia at gcc dot gnu dot org
  2005-01-18 10:12 ` jakub at gcc dot gnu dot org
                   ` (5 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-01-17 23:18 UTC (permalink / raw)
  To: gcc-bugs



-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |lerdsuwa at users dot
                   |                            |sourceforge dot net
             Status|UNCONFIRMED                 |NEW
     Ever Confirmed|                            |1
   Last reconfirmed|0000-00-00 00:00:00         |2005-01-17 23:18:47
               date|                            |


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


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

* [Bug c++/19349] [4.0 Regression] Valgrind errors compiling libjava c++ sources
  2005-01-09 20:38 [Bug c++/19349] New: Valgrind errors compiling libjava c++ sources mark at gcc dot gnu dot org
                   ` (3 preceding siblings ...)
  2005-01-17 23:18 ` pinskia at gcc dot gnu dot org
@ 2005-01-18 10:12 ` jakub at gcc dot gnu dot org
  2005-01-18 11:23 ` steven at gcc dot gnu dot org
                   ` (4 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: jakub at gcc dot gnu dot org @ 2005-01-18 10:12 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From jakub at gcc dot gnu dot org  2005-01-18 10:12 -------
This bug was introduced by Mark's
http://gcc.gnu.org/ml/gcc-patches/2004-12/msg02130.html
patch, particularly ggc_free (newdecl); in duplicate_decls.
name-lookup.c apparently uses it, although it is freed now.

On the short testcase above, ggc_free is called from:
#2  0x084bfe45 in ggc_free (p=0xf7d64a8c) at ../../gcc/ggc-page.c:1339
#3  0x08068d2d in duplicate_decls (newdecl=0xf7d64a8c, olddecl=0xf7d643cc) at
../../gcc/cp/decl.c:2010
#4  0x08153483 in pushdecl (x=0xf7d64a8c) at ../../gcc/cp/name-lookup.c:701
#5  0x0815765b in pushdecl_with_scope (x=0xf7d64a8c, level=0xf7cdda20) at
../../gcc/cp/name-lookup.c:1816
#6  0x0815bd61 in pushdecl_namespace_level (x=0xf7d64a8c) at
../../gcc/cp/name-lookup.c:3023
but pushdecl_namespace_level certainly doesn't expect X to be freed and uses
it after the pushdecl_with_scope call:

3023      t = pushdecl_with_scope (x, NAMESPACE_LEVEL (current_namespace));
3024
3025      /* Now, the type_shadowed stack may screw us.  Munge it so it does
3026         what we want.  */
3027      if (TREE_CODE (x) == TYPE_DECL)


-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |mark at codesourcery dot com


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


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

* [Bug c++/19349] [4.0 Regression] Valgrind errors compiling libjava c++ sources
  2005-01-09 20:38 [Bug c++/19349] New: Valgrind errors compiling libjava c++ sources mark at gcc dot gnu dot org
                   ` (4 preceding siblings ...)
  2005-01-18 10:12 ` jakub at gcc dot gnu dot org
@ 2005-01-18 11:23 ` steven at gcc dot gnu dot org
  2005-01-18 14:39 ` pinskia at gcc dot gnu dot org
                   ` (3 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: steven at gcc dot gnu dot org @ 2005-01-18 11:23 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From steven at gcc dot gnu dot org  2005-01-18 11:22 -------
That's strange.  I thought ggc_free should poison the memory that is
freed if the compiler is built with checking enabled.  So anything
that uses it after the ggc_free should segfault or die in a similar
horrible way.

Did someone remove ENABLE_GC_CHECKING from --enable-checking??

-- 


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


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

* [Bug c++/19349] [4.0 Regression] Valgrind errors compiling libjava c++ sources
  2005-01-09 20:38 [Bug c++/19349] New: Valgrind errors compiling libjava c++ sources mark at gcc dot gnu dot org
                   ` (5 preceding siblings ...)
  2005-01-18 11:23 ` steven at gcc dot gnu dot org
@ 2005-01-18 14:39 ` pinskia at gcc dot gnu dot org
  2005-01-18 16:53 ` mmitchel at gcc dot gnu dot org
                   ` (2 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-01-18 14:39 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2005-01-18 14:33 -------
(In reply to comment #4)
> That's strange.  I thought ggc_free should poison the memory that is
> freed if the compiler is built with checking enabled.  So anything
> that uses it after the ggc_free should segfault or die in a similar
> horrible way.
> 
> Did someone remove ENABLE_GC_CHECKING from --enable-checking??

No, we do poison it but since this is only a read we don't get any diagnostic unless you use
valgrind because we poison it even further with valgrind and say the memory is useless.

Mark thought his patch was safe and he even tried to explain why he thought it was safe but this is the 
second bug which was effected by it.



-- 


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


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

* [Bug c++/19349] [4.0 Regression] Valgrind errors compiling libjava c++ sources
  2005-01-09 20:38 [Bug c++/19349] New: Valgrind errors compiling libjava c++ sources mark at gcc dot gnu dot org
                   ` (6 preceding siblings ...)
  2005-01-18 14:39 ` pinskia at gcc dot gnu dot org
@ 2005-01-18 16:53 ` mmitchel at gcc dot gnu dot org
  2005-01-31  1:17 ` cvs-commit at gcc dot gnu dot org
  2005-01-31  1:21 ` mmitchel at gcc dot gnu dot org
  9 siblings, 0 replies; 11+ messages in thread
From: mmitchel at gcc dot gnu dot org @ 2005-01-18 16:53 UTC (permalink / raw)
  To: gcc-bugs



-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
         AssignedTo|unassigned at gcc dot gnu   |mark at codesourcery dot com
                   |dot org                     |
             Status|NEW                         |ASSIGNED


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


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

* [Bug c++/19349] [4.0 Regression] Valgrind errors compiling libjava c++ sources
  2005-01-09 20:38 [Bug c++/19349] New: Valgrind errors compiling libjava c++ sources mark at gcc dot gnu dot org
                   ` (7 preceding siblings ...)
  2005-01-18 16:53 ` mmitchel at gcc dot gnu dot org
@ 2005-01-31  1:17 ` cvs-commit at gcc dot gnu dot org
  2005-01-31  1:21 ` mmitchel at gcc dot gnu dot org
  9 siblings, 0 replies; 11+ messages in thread
From: cvs-commit at gcc dot gnu dot org @ 2005-01-31  1:17 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From cvs-commit at gcc dot gnu dot org  2005-01-31 01:17 -------
Subject: Bug 19349

CVSROOT:	/cvs/gcc
Module name:	gcc
Changes by:	mmitchel@gcc.gnu.org	2005-01-31 01:17:19

Modified files:
	gcc/cp         : call.c cp-tree.h semantics.c typeck.c 
	                 name-lookup.c ChangeLog 
	gcc/testsuite  : ChangeLog 
Added files:
	gcc/testsuite/g++.dg/warn: conv3.C 

Log message:
	PR c++/19457
	* call.c (convert_like_real): Inline call to
	dubious_conversion_warnings here.
	* cp-tree.h (dubious_conversion_warnings): Remove.
	* semantics.c (finish_unary_op_expr): Copy INTEGER_CSTs before
	setting TREE_NEGATED_INT.
	* typeck.c (dubious_conversion_warnings): Remove.
	
	PR c++/19349
	* name-lookup.c (pushdecl_namespace_level): Avoid accessing free'd
	memory.
	
	PR c++/19457
	* g++.dg/warn/conv3.C: New test.

Patches:
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/call.c.diff?cvsroot=gcc&r1=1.527&r2=1.528
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/cp-tree.h.diff?cvsroot=gcc&r1=1.1097&r2=1.1098
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/semantics.c.diff?cvsroot=gcc&r1=1.458&r2=1.459
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/typeck.c.diff?cvsroot=gcc&r1=1.609&r2=1.610
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/name-lookup.c.diff?cvsroot=gcc&r1=1.106&r2=1.107
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/ChangeLog.diff?cvsroot=gcc&r1=1.4601&r2=1.4602
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/g++.dg/warn/conv3.C.diff?cvsroot=gcc&r1=NONE&r2=1.1
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/ChangeLog.diff?cvsroot=gcc&r1=1.4959&r2=1.4960



-- 


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


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

* [Bug c++/19349] [4.0 Regression] Valgrind errors compiling libjava c++ sources
  2005-01-09 20:38 [Bug c++/19349] New: Valgrind errors compiling libjava c++ sources mark at gcc dot gnu dot org
                   ` (8 preceding siblings ...)
  2005-01-31  1:17 ` cvs-commit at gcc dot gnu dot org
@ 2005-01-31  1:21 ` mmitchel at gcc dot gnu dot org
  9 siblings, 0 replies; 11+ messages in thread
From: mmitchel at gcc dot gnu dot org @ 2005-01-31  1:21 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From mmitchel at gcc dot gnu dot org  2005-01-31 01:21 -------
Fixed in GCC 4.0.

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


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


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

end of thread, other threads:[~2005-01-31  1:21 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-01-09 20:38 [Bug c++/19349] New: Valgrind errors compiling libjava c++ sources mark at gcc dot gnu dot org
2005-01-10 15:35 ` [Bug c++/19349] [4.0 Regression] " pinskia at gcc dot gnu dot org
2005-01-10 15:35 ` [Bug c++/19349] " pinskia at gcc dot gnu dot org
2005-01-17 21:23 ` [Bug c++/19349] [4.0 Regression] " jakub at gcc dot gnu dot org
2005-01-17 23:18 ` pinskia at gcc dot gnu dot org
2005-01-18 10:12 ` jakub at gcc dot gnu dot org
2005-01-18 11:23 ` steven at gcc dot gnu dot org
2005-01-18 14:39 ` pinskia at gcc dot gnu dot org
2005-01-18 16:53 ` mmitchel at gcc dot gnu dot org
2005-01-31  1:17 ` cvs-commit at gcc dot gnu dot org
2005-01-31  1:21 ` mmitchel 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).