* Re: [PATCH] Proposed fix for bug #31899
[not found] ` <4aca3dc20707312205g5ac078e3v1a1e72c01206ab3b@mail.gmail.com>
@ 2007-08-01 5:48 ` Doug Kwan (關振德)
2007-08-03 19:31 ` Diego Novillo
0 siblings, 1 reply; 9+ messages in thread
From: Doug Kwan (關振德) @ 2007-08-01 5:48 UTC (permalink / raw)
To: Daniel Berlin, gcc-patches
Hi Dan
It is a bug in dwarf2out.c that causes an ICE because
reference_to_unused assumed it is never called until the call-graph is
complete if gcc is compiling a unit at a time. That assumption is not
true as g++ tries to decide if it want to emits debugging info early
during passing. The fix is to handle this situation and make
reference_to_unused conservative. The effect is that we always defer
emission of some debug info that we used to emit early.
Ian says you are also familiar with the dwarf2 code. Maybe you could
take a look as well? Both Diego and I think this fix is reasonable but
we are not sure if it is 100% safe.
-Doug
2007/7/31, Daniel Berlin <dberlin@dberlin.org>:
> You should say what the bug is about in the message, and how your fix
> fixes it. I couldn't tell anything about whether this is something i
> should look at (IE i maintain) from the subject. For most
> maintainers, when that happens, they ignore it :)
> Also, you are 999999 times more likely to get a response if you cc the
> maintainer for that area.
>
> On 7/31/07, Doug Kwan (關振德) <dougkwan@google.com> wrote:
> > Hi,
> >
> > Could someone review and approve this? Thanks.
> >
> > -Doug
> >
> >
>
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH] Proposed fix for bug #31899
2007-08-01 5:48 ` [PATCH] Proposed fix for bug #31899 Doug Kwan (關振德)
@ 2007-08-03 19:31 ` Diego Novillo
2007-08-06 3:19 ` Mark Mitchell
0 siblings, 1 reply; 9+ messages in thread
From: Diego Novillo @ 2007-08-03 19:31 UTC (permalink / raw)
To: "Doug Kwan (Ãö®¶¼w)"
Cc: Daniel Berlin, gcc-patches, Jan Hubicka
On 8/1/07 1:48 AM, Doug Kwan (Ãö®¶¼w) wrote:
> Both Diego and I think this fix is reasonable but we are not sure if
> it is 100% safe.
I discussed this problem with Jan on IRC. While the patch is reasonably
safe, it's mostly a workaround to the real problem. The C++ FE should
not be deciding to emit debug information so early.
Long term, the fix is for the FEs to put these symbols on a queue that
will be later processed by the call-graph. This way we delay emitting
the debugging information until the cgraph has been analyzed.
For 4.2, Jan agrees that this fix is safe enough. The only risk is that
DWARF2 may consider a variable both optimized out and directly
referenced. But given that this has not occurred too frequently, it may
not be such a big deal.
Doug, the patch is fine for 4.2. One minor nit with the changelog entry:
> * dwarf2out.c: (may_reference_to_unsued) : Renamed from reference_to_unsued
> as it is now more conservative than before. Replace unreachable assert
> into a return that tells caller that tree may reference an unused DECL.
> (rtl_for_decl_init): Rename callee to may_reference_to_usused.
No ':' before (may_referenced_to_unused).
No need to explain *why* the change was made. The ChangeLog only states
*what* changed. The *why* is in the comments in the code.
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH] Proposed fix for bug #31899
2007-08-03 19:31 ` Diego Novillo
@ 2007-08-06 3:19 ` Mark Mitchell
2007-08-07 2:00 ` Doug Kwan (關振德)
2007-08-07 14:30 ` Diego Novillo
0 siblings, 2 replies; 9+ messages in thread
From: Mark Mitchell @ 2007-08-06 3:19 UTC (permalink / raw)
To: Diego Novillo
Cc: "Doug Kwan (Ãö®¶¼w)",
Daniel Berlin, gcc-patches, Jan Hubicka
Diego Novillo wrote:
> For 4.2, Jan agrees that this fix is safe enough. The only risk is that
> DWARF2 may consider a variable both optimized out and directly
> referenced. But given that this has not occurred too frequently, it may
> not be such a big deal.
>
> Doug, the patch is fine for 4.2. One minor nit with the changelog entry:
Please don't put the patch in for 4.2 without a fix for mainline.
Otherwise, we risk regressing in 4.3. Obviously, we don't want 4.2.2 to
have this bug, but we need a plan here.
If this patch is OK for 4.2, as a work-around, can we just put it into
4.3 as well? Or, Doug, are you willing to work on the queuing code for
4.3? I would be happy to review that.
Thanks,
--
Mark Mitchell
CodeSourcery
mark@codesourcery.com
(650) 331-3385 x713
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH] Proposed fix for bug #31899
2007-08-06 3:19 ` Mark Mitchell
@ 2007-08-07 2:00 ` Doug Kwan (關振德)
2007-08-07 14:30 ` Diego Novillo
1 sibling, 0 replies; 9+ messages in thread
From: Doug Kwan (關振德) @ 2007-08-07 2:00 UTC (permalink / raw)
To: Mark Mitchell; +Cc: Diego Novillo, Daniel Berlin, gcc-patches, Jan Hubicka
Hi Mark,
I am more than happy to queue this for 4.3. Please review that for
the mainline.
-Doug
2007/8/5, Mark Mitchell <mark@codesourcery.com>:
> Please don't put the patch in for 4.2 without a fix for mainline.
> Otherwise, we risk regressing in 4.3. Obviously, we don't want 4.2.2 to
> have this bug, but we need a plan here.
>
> If this patch is OK for 4.2, as a work-around, can we just put it into
> 4.3 as well? Or, Doug, are you willing to work on the queuing code for
> 4.3? I would be happy to review that.
>
> Thanks,
>
> --
> Mark Mitchell
> CodeSourcery
> mark@codesourcery.com
> (650) 331-3385 x713
>
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH] Proposed fix for bug #31899
2007-08-06 3:19 ` Mark Mitchell
2007-08-07 2:00 ` Doug Kwan (關振德)
@ 2007-08-07 14:30 ` Diego Novillo
2007-08-07 14:35 ` Mark Mitchell
1 sibling, 1 reply; 9+ messages in thread
From: Diego Novillo @ 2007-08-07 14:30 UTC (permalink / raw)
To: Mark Mitchell
Cc: "Doug Kwan (Ãö®¶¼w)",
Daniel Berlin, gcc-patches, Jan Hubicka
On 8/5/07 11:19 PM, Mark Mitchell wrote:
> If this patch is OK for 4.2, as a work-around, can we just put it into
> 4.3 as well? Or, Doug, are you willing to work on the queuing code for
> 4.3? I would be happy to review that.
Yes, I think it wouldn't hurt in 4.3.
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH] Proposed fix for bug #31899
2007-08-07 14:30 ` Diego Novillo
@ 2007-08-07 14:35 ` Mark Mitchell
2007-10-02 17:09 ` Richard Guenther
0 siblings, 1 reply; 9+ messages in thread
From: Mark Mitchell @ 2007-08-07 14:35 UTC (permalink / raw)
To: Diego Novillo
Cc: "Doug Kwan (Ãö®¶¼w)",
Daniel Berlin, gcc-patches, Jan Hubicka
Diego Novillo wrote:
> On 8/5/07 11:19 PM, Mark Mitchell wrote:
>
>> If this patch is OK for 4.2, as a work-around, can we just put it into
>> 4.3 as well? Or, Doug, are you willing to work on the queuing code for
>> 4.3? I would be happy to review that.
>
> Yes, I think it wouldn't hurt in 4.3.
OK, let's do that then.
Thanks,
--
Mark Mitchell
CodeSourcery
mark@codesourcery.com
(650) 331-3385 x713
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH] Proposed fix for bug #31899
2007-08-07 14:35 ` Mark Mitchell
@ 2007-10-02 17:09 ` Richard Guenther
2007-10-02 17:24 ` Doug Kwan (關振德)
0 siblings, 1 reply; 9+ messages in thread
From: Richard Guenther @ 2007-10-02 17:09 UTC (permalink / raw)
To: Mark Mitchell
Cc: Diego Novillo,
"Doug Kwan (Ãö®¶¼w)",
Daniel Berlin, gcc-patches, Jan Hubicka
On 8/7/07, Mark Mitchell <mark@codesourcery.com> wrote:
> Diego Novillo wrote:
> > On 8/5/07 11:19 PM, Mark Mitchell wrote:
> >
> >> If this patch is OK for 4.2, as a work-around, can we just put it into
> >> 4.3 as well? Or, Doug, are you willing to work on the queuing code for
> >> 4.3? I would be happy to review that.
> >
> > Yes, I think it wouldn't hurt in 4.3.
>
> OK, let's do that then.
Hm, nothing happened. I'm going to put the fix in mainline after re-testing
and to the branch after 4.2.2.
Richard.
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH] Proposed fix for bug #31899
2007-10-02 17:09 ` Richard Guenther
@ 2007-10-02 17:24 ` Doug Kwan (關振德)
2007-10-03 10:02 ` Richard Guenther
0 siblings, 1 reply; 9+ messages in thread
From: Doug Kwan (關振德) @ 2007-10-02 17:24 UTC (permalink / raw)
To: Richard Guenther
Cc: Mark Mitchell, Diego Novillo, Daniel Berlin, gcc-patches, Jan Hubicka
Sorry. I dropped that. I dont' have an SVN account and I need someone
to commit the patch for me.
-Doug
2007/10/2, Richard Guenther <richard.guenther@gmail.com>:
> On 8/7/07, Mark Mitchell <mark@codesourcery.com> wrote:
> > Diego Novillo wrote:
> > > On 8/5/07 11:19 PM, Mark Mitchell wrote:
> > >
> > >> If this patch is OK for 4.2, as a work-around, can we just put it into
> > >> 4.3 as well? Or, Doug, are you willing to work on the queuing code for
> > >> 4.3? I would be happy to review that.
> > >
> > > Yes, I think it wouldn't hurt in 4.3.
> >
> > OK, let's do that then.
>
> Hm, nothing happened. I'm going to put the fix in mainline after re-testing
> and to the branch after 4.2.2.
>
> Richard.
>
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH] Proposed fix for bug #31899
2007-10-02 17:24 ` Doug Kwan (關振德)
@ 2007-10-03 10:02 ` Richard Guenther
0 siblings, 0 replies; 9+ messages in thread
From: Richard Guenther @ 2007-10-03 10:02 UTC (permalink / raw)
To: Doug Kwan (關振德)
Cc: Mark Mitchell, Diego Novillo, Daniel Berlin, gcc-patches, Jan Hubicka
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain; charset=GB2312, Size: 389 bytes --]
On 10/2/07, Doug Kwan (êPÕñµÂ) <dougkwan@google.com> wrote:
> Sorry. I dropped that. I dont' have an SVN account and I need someone
> to commit the patch for me.
>
> -Doug
> > > OK, let's do that then.
> >
> > Hm, nothing happened. I'm going to put the fix in mainline after re-testing
> > and to the branch after 4.2.2.
> >
> > Richard.
> >
>
I have now applied the attached.
Richard.
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: p.patch --]
[-- Type: text/x-patch; name="p.patch", Size: 1663 bytes --]
2007-10-03 Doug Kwan <dougkwan@google.com>
Richard Guenther <rguenther@suse.de>
PR debug/31899
* dwarf2out.c (reference_to_unused): Disable sanity checking,
be conservative instead.
* g++.dg/debug/using3.C: New testcase.
Index: dwarf2out.c
===================================================================
*** dwarf2out.c (revision 128977)
--- dwarf2out.c (working copy)
*************** reference_to_unused (tree * tp, int * wa
*** 10344,10352 ****
return *tp;
else if (!flag_unit_at_a_time)
return NULL_TREE;
else if (!cgraph_global_info_ready
&& (TREE_CODE (*tp) == VAR_DECL || TREE_CODE (*tp) == FUNCTION_DECL))
! gcc_unreachable ();
else if (DECL_P (*tp) && TREE_CODE (*tp) == VAR_DECL)
{
struct varpool_node *node = varpool_node (*tp);
--- 10344,10355 ----
return *tp;
else if (!flag_unit_at_a_time)
return NULL_TREE;
+ /* ??? The C++ FE emits debug information for using decls, so
+ putting gcc_unreachable here falls over. See PR31899. For now
+ be conservative. */
else if (!cgraph_global_info_ready
&& (TREE_CODE (*tp) == VAR_DECL || TREE_CODE (*tp) == FUNCTION_DECL))
! return *tp;
else if (DECL_P (*tp) && TREE_CODE (*tp) == VAR_DECL)
{
struct varpool_node *node = varpool_node (*tp);
Index: testsuite/g++.dg/debug/using3.C
===================================================================
*** testsuite/g++.dg/debug/using3.C (revision 0)
--- testsuite/g++.dg/debug/using3.C (revision 0)
***************
*** 0 ****
--- 1,8 ----
+ // PR debug/31899
+
+ namespace NS {
+ int x = 0;
+ int &ref = x;
+ }
+
+ using NS::ref;
^ permalink raw reply [flat|nested] 9+ messages in thread
end of thread, other threads:[~2007-10-03 10:02 UTC | newest]
Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
[not found] <498552560707311623n59a20a21ve83cccf4d5583adc@mail.gmail.com>
[not found] ` <4aca3dc20707312205g5ac078e3v1a1e72c01206ab3b@mail.gmail.com>
2007-08-01 5:48 ` [PATCH] Proposed fix for bug #31899 Doug Kwan (關振德)
2007-08-03 19:31 ` Diego Novillo
2007-08-06 3:19 ` Mark Mitchell
2007-08-07 2:00 ` Doug Kwan (關振德)
2007-08-07 14:30 ` Diego Novillo
2007-08-07 14:35 ` Mark Mitchell
2007-10-02 17:09 ` Richard Guenther
2007-10-02 17:24 ` Doug Kwan (關振德)
2007-10-03 10:02 ` Richard Guenther
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).