diff mbox

Fix PR ada/35998

Message ID 1953979.BppAL6HeZv@polaris
State New
Headers show

Commit Message

Eric Botcazou Nov. 11, 2013, 10:10 a.m. UTC
Hi,

this is an old bug report from Jan, which was closed, then reopened by Tom at 
some point, but the patch never got reviewed.  The original submission is at:
  http://gcc.gnu.org/ml/gcc-patches/2008-05/msg01857.html

Tested on x86_64-suse-linux, OK for the mainline?


2013-11-11  Jan Kratochvil  <jan.kratochvil@redhat.com>

	PR ada/35998
	* dwarf2out.c (add_byte_size_attribute): Omit attribute for size -1.

Comments

Richard Biener Nov. 11, 2013, 12:25 p.m. UTC | #1
On Mon, Nov 11, 2013 at 11:10 AM, Eric Botcazou <ebotcazou@adacore.com> wrote:
> Hi,
>
> this is an old bug report from Jan, which was closed, then reopened by Tom at
> some point, but the patch never got reviewed.  The original submission is at:
>   http://gcc.gnu.org/ml/gcc-patches/2008-05/msg01857.html
>
> Tested on x86_64-suse-linux, OK for the mainline?

Due to the different interfaces of int_size_in_bytes and
simple_type_size_in_bits (and 'size' in add_byte_size_attribute being
unsigned and not [unsigned] HWI) it would be cleaner to
add an early return after the call to int_size_in_bytes if its
return value is -1 (and make sure the return value doesn't
overflow an unsigned int - likewise for simple_type_size_in_bits,
not sure why that case doesn't use int_size_in_bytes as well ...)?

Can you apply some TLC here?

Thanks,
Richard.

>
> 2013-11-11  Jan Kratochvil  <jan.kratochvil@redhat.com>
>
>         PR ada/35998
>         * dwarf2out.c (add_byte_size_attribute): Omit attribute for size -1.
>
>
> --
> Eric Botcazou
diff mbox

Patch

Index: dwarf2out.c
===================================================================
--- dwarf2out.c	(revision 204444)
+++ dwarf2out.c	(working copy)
@@ -16355,9 +16355,10 @@  add_byte_size_attribute (dw_die_ref die,
 
   /* Note that `size' might be -1 when we get to this point.  If it is, that
      indicates that the byte size of the entity in question is variable.  We
-     have no good way of expressing this fact in Dwarf at the present time,
-     so just let the -1 pass on through.  */
-  add_AT_unsigned (die, DW_AT_byte_size, size);
+     have no good way of expressing this fact in Dwarf at the present time
+     when location description was not used by the caller code instead.  */
+  if (size != (unsigned) -1)
+    add_AT_unsigned (die, DW_AT_byte_size, size);
 }
 
 /* For a FIELD_DECL node which represents a bit-field, output an attribute