public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug debug/17799] New: Non-optimizing compile loses 'this'
@ 2004-10-03 2:24 rth at gcc dot gnu dot org
2004-10-03 2:25 ` [Bug debug/17799] " rth at gcc dot gnu dot org
` (6 more replies)
0 siblings, 7 replies; 8+ messages in thread
From: rth at gcc dot gnu dot org @ 2004-10-03 2:24 UTC (permalink / raw)
To: gcc-bugs
With the attached test case, compile with
g++ -g z.cc -lpthread
(gdb) b 'Foo::bar()'
Breakpoint 1 at 0x804850d: file z.c, line 34.
(gdb) run
Starting program: /home/rth/x/a.out
[Thread debugging using libthread_db enabled]
[New Thread -1220950400 (LWP 31166)]
[New Thread -1220953168 (LWP 31169)]
[Switching to Thread -1220953168 (LWP 31169)]
Breakpoint 1, Foo::bar (this=0x80498c0) at z.c:34
34 if (_y!=MODEB)
Current language: auto; currently c++
(gdb) p this
$1 = (Foo * const) 0x80498c0
(gdb) n
38 return true;
(gdb) p this
$2 = (Foo * const) 0x0
While it's completely understandable for variables to be optimized away
with optimization, it's uncool for it to happen when compiling at -O0.
I'm pretty sure this due to the fact that 'this' is marked DECL_ARTIFICIAL
by the C++ front end, and DECL_ARTIFICIAL variables are allocated to
registers rather than on the stack.
This is a regression from gcc 3.4.
--
Summary: Non-optimizing compile loses 'this'
Product: gcc
Version: 4.0.0
Status: UNCONFIRMED
Severity: normal
Priority: P2
Component: debug
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: rth at gcc dot gnu dot org
CC: gcc-bugs at gcc dot gnu dot org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=17799
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug debug/17799] Non-optimizing compile loses 'this'
2004-10-03 2:24 [Bug debug/17799] New: Non-optimizing compile loses 'this' rth at gcc dot gnu dot org
@ 2004-10-03 2:25 ` rth at gcc dot gnu dot org
2004-10-03 2:56 ` [Bug debug/17799] [4.0 Regression] " pinskia at gcc dot gnu dot org
` (5 subsequent siblings)
6 siblings, 0 replies; 8+ messages in thread
From: rth at gcc dot gnu dot org @ 2004-10-03 2:25 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From rth at gcc dot gnu dot org 2004-10-03 02:25 -------
Created an attachment (id=7261)
--> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=7261&action=view)
test case
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=17799
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug debug/17799] [4.0 Regression] Non-optimizing compile loses 'this'
2004-10-03 2:24 [Bug debug/17799] New: Non-optimizing compile loses 'this' rth at gcc dot gnu dot org
2004-10-03 2:25 ` [Bug debug/17799] " rth at gcc dot gnu dot org
@ 2004-10-03 2:56 ` pinskia at gcc dot gnu dot org
2004-10-03 17:48 ` pinskia at gcc dot gnu dot org
` (4 subsequent siblings)
6 siblings, 0 replies; 8+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-10-03 2:56 UTC (permalink / raw)
To: gcc-bugs
--
What |Removed |Added
----------------------------------------------------------------------------
Keywords| |wrong-debug
Summary|Non-optimizing compile loses|[4.0 Regression] Non-
|'this' |optimizing compile loses
| |'this'
Target Milestone|--- |4.0.0
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=17799
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug debug/17799] [4.0 Regression] Non-optimizing compile loses 'this'
2004-10-03 2:24 [Bug debug/17799] New: Non-optimizing compile loses 'this' rth at gcc dot gnu dot org
2004-10-03 2:25 ` [Bug debug/17799] " rth at gcc dot gnu dot org
2004-10-03 2:56 ` [Bug debug/17799] [4.0 Regression] " pinskia at gcc dot gnu dot org
@ 2004-10-03 17:48 ` pinskia at gcc dot gnu dot org
2004-12-21 19:43 ` [Bug c++/17799] " mmitchel at gcc dot gnu dot org
` (3 subsequent siblings)
6 siblings, 0 replies; 8+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-10-03 17:48 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From pinskia at gcc dot gnu dot org 2004-10-03 17:48 -------
Confirmed.
--
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |NEW
Ever Confirmed| |1
Last reconfirmed|0000-00-00 00:00:00 |2004-10-03 17:48:28
date| |
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=17799
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug c++/17799] [4.0 Regression] Non-optimizing compile loses 'this'
2004-10-03 2:24 [Bug debug/17799] New: Non-optimizing compile loses 'this' rth at gcc dot gnu dot org
` (2 preceding siblings ...)
2004-10-03 17:48 ` pinskia at gcc dot gnu dot org
@ 2004-12-21 19:43 ` mmitchel at gcc dot gnu dot org
2004-12-22 5:27 ` [Bug middle-end/17799] " rth at gcc dot gnu dot org
` (2 subsequent siblings)
6 siblings, 0 replies; 8+ messages in thread
From: mmitchel at gcc dot gnu dot org @ 2004-12-21 19:43 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From mmitchel at gcc dot gnu dot org 2004-12-21 19:43 -------
Richard, do you consider this a C++ front-end bug?
It does not seem to be a front-end bug to me; the "this" parameter is in fact
compiler-generated. It's been marked DECL_ARTIFICIAL since time immemorila.
Maybe the middle end should be performing this optimization at -O0 only if
DECL_IGNORED_P is set. If you agree, we should recategorize this defect.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=17799
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug middle-end/17799] [4.0 Regression] Non-optimizing compile loses 'this'
2004-10-03 2:24 [Bug debug/17799] New: Non-optimizing compile loses 'this' rth at gcc dot gnu dot org
` (3 preceding siblings ...)
2004-12-21 19:43 ` [Bug c++/17799] " mmitchel at gcc dot gnu dot org
@ 2004-12-22 5:27 ` rth at gcc dot gnu dot org
2005-01-01 1:43 ` cvs-commit at gcc dot gnu dot org
2005-01-01 1:45 ` rth at gcc dot gnu dot org
6 siblings, 0 replies; 8+ messages in thread
From: rth at gcc dot gnu dot org @ 2004-12-22 5:27 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From rth at gcc dot gnu dot org 2004-12-22 05:27 -------
I think I agree about only putting stuff in registers for DECL_IGNORED_P.
--
What |Removed |Added
----------------------------------------------------------------------------
AssignedTo|unassigned at gcc dot gnu |rth at gcc dot gnu dot org
|dot org |
Status|NEW |ASSIGNED
Component|c++ |middle-end
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=17799
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug middle-end/17799] [4.0 Regression] Non-optimizing compile loses 'this'
2004-10-03 2:24 [Bug debug/17799] New: Non-optimizing compile loses 'this' rth at gcc dot gnu dot org
` (4 preceding siblings ...)
2004-12-22 5:27 ` [Bug middle-end/17799] " rth at gcc dot gnu dot org
@ 2005-01-01 1:43 ` cvs-commit at gcc dot gnu dot org
2005-01-01 1:45 ` rth at gcc dot gnu dot org
6 siblings, 0 replies; 8+ messages in thread
From: cvs-commit at gcc dot gnu dot org @ 2005-01-01 1:43 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From cvs-commit at gcc dot gnu dot org 2005-01-01 01:43 -------
Subject: Bug 17799
CVSROOT: /cvs/gcc
Module name: gcc
Changes by: rth@gcc.gnu.org 2005-01-01 01:43:13
Modified files:
gcc : ChangeLog c-decl.c dwarf2asm.c function.c
gimplify.c tree-inline.c tree-outof-ssa.c
var-tracking.c
gcc/cp : ChangeLog call.c class.c decl2.c init.c rtti.c
tree.c
Log message:
PR middle-end/17799
* function.c (use_register_for_decl): Check DECL_IGNORED_P instead
of DECL_ARTIFICIAL.
(assign_parms_augmented_arg_list): Set DECL_IGNORED_P.
* c-decl.c (build_compound_literal): Likewise.
* dwarf2asm.c (dw2_force_const_mem): Likewise.
* gimplify.c (create_artificial_label): Likewise.
* tree-inline.c (expand_call_inline): Likewise.
* var-tracking.c (vt_initialize): Likewise.
* tree-outof-ssa.c (create_temp): Copy DECL_IGNORED_P.
cp/
* call.c (make_temporary_var_for_ref_to_temp): Set DECL_IGNORED_P.
* class.c (build_vtable): Don't conditionallize setting it
based on DWARF2_DEBUG.
(layout_class_type): Set DECL_IGNORED_P.
* decl2.c (get_guard): Likewise.
* rtti.c (get_tinfo_decl, build_lang_decl): Likewise.
* tree.c (build_local_temp): Likewise.
Patches:
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/ChangeLog.diff?cvsroot=gcc&r1=2.6992&r2=2.6993
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/c-decl.c.diff?cvsroot=gcc&r1=1.619&r2=1.620
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/dwarf2asm.c.diff?cvsroot=gcc&r1=1.40&r2=1.41
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/function.c.diff?cvsroot=gcc&r1=1.597&r2=1.598
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/gimplify.c.diff?cvsroot=gcc&r1=2.100&r2=2.101
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/tree-inline.c.diff?cvsroot=gcc&r1=1.160&r2=1.161
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/tree-outof-ssa.c.diff?cvsroot=gcc&r1=2.38&r2=2.39
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/var-tracking.c.diff?cvsroot=gcc&r1=2.23&r2=2.24
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/ChangeLog.diff?cvsroot=gcc&r1=1.4564&r2=1.4565
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/call.c.diff?cvsroot=gcc&r1=1.525&r2=1.526
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/class.c.diff?cvsroot=gcc&r1=1.697&r2=1.698
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/decl2.c.diff?cvsroot=gcc&r1=1.762&r2=1.763
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/init.c.diff?cvsroot=gcc&r1=1.407&r2=1.408
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/rtti.c.diff?cvsroot=gcc&r1=1.207&r2=1.208
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/tree.c.diff?cvsroot=gcc&r1=1.421&r2=1.422
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=17799
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug middle-end/17799] [4.0 Regression] Non-optimizing compile loses 'this'
2004-10-03 2:24 [Bug debug/17799] New: Non-optimizing compile loses 'this' rth at gcc dot gnu dot org
` (5 preceding siblings ...)
2005-01-01 1:43 ` cvs-commit at gcc dot gnu dot org
@ 2005-01-01 1:45 ` rth at gcc dot gnu dot org
6 siblings, 0 replies; 8+ messages in thread
From: rth at gcc dot gnu dot org @ 2005-01-01 1:45 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From rth at gcc dot gnu dot org 2005-01-01 01:45 -------
Fixed.
--
What |Removed |Added
----------------------------------------------------------------------------
Status|ASSIGNED |RESOLVED
Resolution| |FIXED
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=17799
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2005-01-01 1:45 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-10-03 2:24 [Bug debug/17799] New: Non-optimizing compile loses 'this' rth at gcc dot gnu dot org
2004-10-03 2:25 ` [Bug debug/17799] " rth at gcc dot gnu dot org
2004-10-03 2:56 ` [Bug debug/17799] [4.0 Regression] " pinskia at gcc dot gnu dot org
2004-10-03 17:48 ` pinskia at gcc dot gnu dot org
2004-12-21 19:43 ` [Bug c++/17799] " mmitchel at gcc dot gnu dot org
2004-12-22 5:27 ` [Bug middle-end/17799] " rth at gcc dot gnu dot org
2005-01-01 1:43 ` cvs-commit at gcc dot gnu dot org
2005-01-01 1:45 ` rth 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).