[RFA] PR 11530: Fix and test case

Jan Kratochvil jan.kratochvil@redhat.com
Fri Apr 30 08:20:00 GMT 2010


On Thu, 29 Apr 2010 23:50:15 +0200, Pierre Muller wrote:
> --- src/gdb/gdbtypes.c	21 Apr 2010 23:21:03 -0000	1.189
> +++ src/gdb/gdbtypes.c	29 Apr 2010 21:23:35 -0000
> @@ -1246,6 +1246,13 @@ lookup_struct_elt_type (struct type *typ
>  	{
>  	  return TYPE_FIELD_TYPE (type, i);
>  	}
> +      else if (!t_field_name || *t_field_name == '\0')
> +	{
> +	  struct type *subtype = lookup_struct_elt_type (
> +				   TYPE_FIELD_TYPE (type, i), name, 1);

IMO
	  struct type *subtype;

	  subtype = lookup_struct_elt_type TYPE_FIELD_TYPE (type, i), name, 1);

> +	  if (subtype != NULL)
> +	    return subtype;
> +	}
>      }


I was now thinking about a possible name clash.  As these anonymous
structs/unions are a GNU extension there is no offical standard for it but the
GCC texinfo file describes it as an error which GCC currently does not report.
I have not found a GCC PR for it.

------------------------------------------------------------------------------
(gcc)Unnamed Fields
 You must never create such structures that cause ambiguous field
definitions.  For example, this structure:

     struct {
       int a;
       struct {
         int a;
       };
     } foo;

 It is ambiguous which `a' is being referred to with `foo.a'.  Such
constructs are not supported and must be avoided.  In the future, such
constructs may be detected and treated as compilation errors.
------------------------------------------------------------------------------


> +struct a
> +  {
> +    union
> +      {
> +        int i;
> +      };
> +  } a;

Possibly to test also `struct' there to get better test coverage.


> +if { ![runto main] } then {
          runto_main

But I do not understand how those embedded remote stubs work.



Thanks,
Jan



More information about the Gdb-patches mailing list