[PATCH][PR debug/60655] Power/GCC: Reject cross-section symbol subtraction

Alan Modra amodra@gmail.com
Fri Sep 5 01:30:00 GMT 2014

On Thu, Sep 04, 2014 at 10:05:38PM +0100, Maciej W. Rozycki wrote:
> On Thu, 4 Sep 2014, Alan Modra wrote:
> > > In fact if you look at the corresponding location expression for
> > > -fno-section-anchors code you get something quite screwy too.
> > > 
> > > 0000018f 00000108 00000114 (DW_OP_breg10 (r10): 0; DW_OP_addr: 144; DW_OP_plus; DW_OP_stack_value
> > > 
> > > which is (r10) + &modulus.
> > 
> > Fixed with this obvious patch.  Emitting part of a .debug_loc expression
> > is worse than no expression.  Bootstrapped and regression tested
> > x86_64-linux and committed revision 214899.
> > 
> > 	PR debug/60655
> > 	* dwarf2out.c (mem_loc_descriptor <PLUS>): Return NULL if addend
> > 	can't be output.
>  Thanks for your analysis and the fix, unfortunately the test case still 
> fails here, so it must be something else yet. :(

Yes, my patch wasn't supposed to fix the testcase, just ensure that we
don't get partial (and thus wrong) expressions emitted when
const_ok_for_output rejects part of a location description.  Jakub's
2014-04-04 patch rejected NOT, which is what we happen to hit for

Your patch rejects the problematic MINUS case seen with
-fsection-anchors, and prior to my mem_loc_descriptor fix, left us
with bogus debug info.  That bogus debug info was my main objection to
your patch going onto trunk.  Since that is now fixed and rejecting
the MINUS is no worse than rejecting NOT, I withdraw that objection.

Of course it would be better to repair the damage done to debug info
rather than rejecting it outright..

Alan Modra
Australia Development Lab, IBM

More information about the Gcc-patches mailing list