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

--- Comment #2 from Nick Clifton <nickc at redhat dot com> 2011-12-01 10:54:35 
UTC ---
[Darn - hit return too early].

When compiling for a target that supports multiple pointer sizes (eg s390)
generating debug information can trigger an ICE in the compiler:

  % s390-gcc -c -g -O2 -m64 fred.i
  fred.i: In function 'bar':
  fred.i:37:1: internal compiler error: in expand_debug_locations, at
cfgexpand.c:3687

The insn looks like this:

  (debug_insn 6 5 7 2 (var_location:SI temp$union_field$ptr_field (scratch))
fred.i:31 -1 (nil))

but the debug expression associated with it looks like this:

  (debug_expr:DI D#1)

The problem, I believe, is in the assertion at line 3687, not the debug
expression itself.  The expression has been created by converting the gimple
for the right hand side of the assignment on line 31 of fred.i:

   & arg_1(D)->bytes

into tree form.  This conversion chooses DImode since that is the default
pointer mode on this particular target.  The fact that this expression is then
cast to an SImode pointer is irrelevant - the expression itself is a DImode
pointer expression.

I have uploaded a proposed patch for this problem, based on an original patch
created by DJ, but tweaked a little bit by me.  It extends the assetion in
expand_debug_locations() to allow for the fact that pointer expressions might
use multiple modes.

Cheers
  Nick

Reply via email to