bootstrap/4727: dwarf2 debugging crashes cc1plus building libstdc++

brendan@zen.org brendan@zen.org
Mon Oct 29 03:26:00 GMT 2001


>Number:         4727
>Category:       bootstrap
>Synopsis:       dwarf2 debugging crashes cc1plus building libstdc++
>Confidential:   no
>Severity:       critical
>Priority:       medium
>Responsible:    unassigned
>State:          open
>Class:          ice-on-legal-code
>Submitter-Id:   net
>Arrival-Date:   Mon Oct 29 03:26:00 PST 2001
>Closed-Date:
>Last-Modified:
>Originator:     Brendan Kehoe
>Release:        CVS tree
>Organization:
>Environment:

>Description:
In dwarf2out.c's function add_const_value_attribute, it has

	/* ??? We really should be using HOST_WIDE_INT throughout.  */
	if (val < 0 && (long) val == val)
	  add_AT_int (die, DW_AT_const_value, (long) val);
	else if ((unsigned long) val == (unsigned HOST_WIDE_INT) val)
	  add_AT_unsigned (die, DW_AT_const_value, (unsigned long) val);
#if HOST_BITS_PER_LONG * 2 == HOST_BITS_PER_WIDE_INT
	add_AT_long_long (die, DW_AT_const_value,
			  val >> HOST_BITS_PER_LONG, val);
#else
	abort ();
#endif

This will call abort() in all cases where long isn't twice the size of an int.
Based on the earlier code, I believe this should in fact be wrapped by an `else {}' block.
>How-To-Repeat:
Configure a build using --with-dwarf2.
>Fix:
Change to only do add_AT_long_long or abort if we qualify to enter an else{} block.

>Release-Note:
>Audit-Trail:
>Unformatted:
----gnatsweb-attachment----
Content-Type: text/plain; name="diffs-dwarf2crash.txt"
Content-Disposition: inline; filename="diffs-dwarf2crash.txt"

2001-10-29  Brendan Kehoe  <brendan@zen.org>

	* dwarf2out.c (add_const_value_attribute): This needs to wrap the
	add_AT_long_long or abort call in else{}.


*** dwarf2out.c.~1~	Sun Oct 28 20:19:08 2001
--- dwarf2out.c	Mon Oct 29 11:06:25 2001
*************** add_const_value_attribute (die, rtl)
*** 8378,8387 ****
  	else if ((unsigned long) val == (unsigned HOST_WIDE_INT) val)
  	  add_AT_unsigned (die, DW_AT_const_value, (unsigned long) val);
  #if HOST_BITS_PER_LONG * 2 == HOST_BITS_PER_WIDE_INT
! 	add_AT_long_long (die, DW_AT_const_value,
! 			  val >> HOST_BITS_PER_LONG, val);
  #else
! 	abort ();
  #endif
        }
        break;
--- 8378,8390 ----
  	else if ((unsigned long) val == (unsigned HOST_WIDE_INT) val)
  	  add_AT_unsigned (die, DW_AT_const_value, (unsigned long) val);
+ 	else
+ 	  {
  #if HOST_BITS_PER_LONG * 2 == HOST_BITS_PER_WIDE_INT
! 	    add_AT_long_long (die, DW_AT_const_value,
! 			      val >> HOST_BITS_PER_LONG, val);
  #else
! 	    abort ();
  #endif
+ 	  }
        }
        break;



More information about the Gcc-bugs mailing list