This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH 7/9] Gccgo port to s390[x] -- part I


This patch extends the -fdump-go-spec option to handle bitfields
and unions and fixes handlinx of zero length arrays.  All of this
is necessary for s390[x] since the system headers use these
features.  Please check the commit comment for a detailed
description of the patch.

gcc/ChangeLog
-------------
2014-09-05  Dominik Vogt  <vogt@linux.vnet.ibm.com>

        * godump.c (precision_to_units): New helper function.
        (go_append_artificial_name): Ditto.
        (go_append_decl_name): Ditto.
        (go_append_bitfield): Ditto.
        (go_get_uinttype_for_precision): Ditto.
        (go_append_padding): Ditto.
        (go_force_record_alignment): Ditto.
        (go_format_type): Represent unions with an array of uints of the size
        of the alignment in go.  This fixes the 'random' size of the union's
        representation using just the first field.
        (go_format_type): Add argument that indicates whether a record is
        nested (used for generation of artificial go names).
        (go_output_fndecl): Adapt to new go_format_type signature.
        (go_output_typedef): Ditto.
        (go_output_var): Ditto.
        (go_output_var): Prefer to output type as alias (typedef).
        (go_format_type): Bitfields in records are simulated as arrays of bytes
        in go.

2014-09-05  Dominik Vogt  <vogt@linux.vnet.ibm.com>

        * godump.c (go_format_type): Fix handling of arrays with zero elements.

gcc/testsuite/ChangeLog
-----------------------
2014-09-05  Dominik Vogt  <vogt@linux.vnet.ibm.com>

        * gcc.misc-tests/godump-1.c: Add tests for bitfields and unions.

2014-09-05  Dominik Vogt  <vogt@linux.vnet.ibm.com>

        * gcc.misc-tests/godump.exp: New.
        * gcc.misc-tests/godump-1.c: New.

Ciao

Dominik ^_^  ^_^

-- 

Dominik Vogt
IBM Germany
>From 01b400c36daba0ef3f96fd9d98d9becbc5b15080 Mon Sep 17 00:00:00 2001
From: Dominik Vogt <vogt@linux.vnet.ibm.com>
Date: Fri, 5 Sep 2014 07:30:56 +0100
Subject: [PATCH 7/9] godump: Support bitfields and unions in go_format_type.

1) Fix handling of arrays with zero elements.

2) Support bitfields and unions in go_format_type.

Bitfields are replaced by byte arrays with synthetic names that cover the space
occupied by the bitfield and any padding after it.

Unions are represented by a struct with a single field that has the name of the
first field of the original record (or "Godump_<n>" if the first field has no
name).  This field is a byte array with the size of the largest field of the
original union.  If alignment of the union does not match the size of the byte
array, an array of integers with the alignment of the union and zero elements is
added at the end of the record to enforce proper alignment (name
"Godump_<n>_align").

Placement of the fields of a record is derived using the internal placement
algorithm in stor.layout.c.  In some cases byte arrays of proper size are
inserted into records to get the alignment right.  Also, if the representation
of a record in Go does not have the proper alignment after all fields have been
converted to Go, an array of integers with the alignment of the recordn and
zero elements is added at the end of the record (name "Godump_<n>_align").

When translating a VAR_DECL, a type that is aliased with typedef (or a struct
or union) is used literally, if possible, and not resolved to builtin types.

Packed records are (still) not supported.

3) Add godump testsuite.
---
 gcc/godump.c                            | 356 +++++++++++++++++-------
 gcc/testsuite/gcc.misc-tests/godump-1.c | 472 ++++++++++++++++++++++++++++++++
 gcc/testsuite/gcc.misc-tests/godump.exp |  36 +++
 3 files changed, 770 insertions(+), 94 deletions(-)
 create mode 100644 gcc/testsuite/gcc.misc-tests/godump-1.c
 create mode 100644 gcc/testsuite/gcc.misc-tests/godump.exp

diff --git a/gcc/godump.c b/gcc/godump.c
index 7566f4d..4f3e69d 100644
--- a/gcc/godump.c
+++ b/gcc/godump.c
@@ -37,6 +37,8 @@ along with GCC; see the file COPYING3.  If not see
 #include "obstack.h"
 #include "debug.h"
 #include "wide-int-print.h"
+#include "stor-layout.h"
+#include "defaults.h"
 
 /* We dump this information from the debug hooks.  This gives us a
    stable and maintainable API to hook into.  In order to work
@@ -73,6 +75,14 @@ struct macro_hash_value
   char *value;
 };
 
+/* Returns the number of units necessary to represent an integer with the given
+   PRECISION (in bits).  */
+static inline unsigned int
+precision_to_units (unsigned int precision)
+{
+  return (precision + BITS_PER_UNIT - 1) / BITS_PER_UNIT;
+}
+
 /* Calculate the hash value for an entry in the macro hash table.  */
 
 static hashval_t
@@ -552,19 +562,129 @@ go_append_string (struct obstack *ob, tree id)
   obstack_grow (ob, IDENTIFIER_POINTER (id), IDENTIFIER_LENGTH (id));
 }
 
+/* Given an integer PRECISION in bits, returns a constant string that is the
+   matching go int or uint type (depending on the IS_UNSIGNED flag).  Returns a
+   NULL pointer if there is no matching go type.  */
+static const char *
+go_get_uinttype_for_precision (unsigned int precision, bool is_unsigned)
+{
+  switch (precision)
+    {
+    case 8:
+      return (is_unsigned) ? "uint8" : "int8";
+    case 16:
+      return (is_unsigned) ? "uint16" : "int16";
+    case 32:
+      return (is_unsigned) ? "uint32" : "int32";
+    case 64:
+      return (is_unsigned) ? "uint64" : "int64";
+    default:
+      return NULL;
+    }
+}
+
+/* Append an artificial variable name with the suffix _INDEX to OB.  Returns
+   INDEX + 1.  */
+
+static unsigned int
+go_append_artificial_name (struct obstack *ob, unsigned int index)
+{
+  char buf[100];
+
+#if 1 /*!!!todo: identifier may not be unique???*/
+#endif
+  obstack_grow (ob, "Godump_", 7);
+  snprintf (buf, sizeof buf, "%u", index);
+  obstack_grow (ob, buf, strlen (buf));
+
+  return index + 1;
+}
+
+/* Append the variable name from DECL to OB.  If the name is in the
+   KEYWORD_HASH, prepend an '_'.  */
+
+static void
+go_append_decl_name (struct obstack *ob, tree decl, htab_t keyword_hash)
+{
+  const char *var_name;
+  void **slot;
+
+  /* Start variable name with an underscore if a keyword.  */
+  var_name = IDENTIFIER_POINTER (DECL_NAME (decl));
+  slot = htab_find_slot (keyword_hash, var_name, NO_INSERT);
+  if (slot != NULL)
+    obstack_1grow (ob, '_');
+  go_append_string (ob, DECL_NAME (decl));
+}
+
+/* Appends a byte array with the necessary number of elements and the name
+   "Godump_INDEX_pad" to pad from FROM_OFFSET to TO_OFFSET to OB assuming that
+   the next field is automatically aligned to ALIGN_UNITS.  Returns INDEX + 1,
+   or INDEX if no padding had to be appended.  The resulting offset where the
+   next field is allocated is returned through RET_OFFSET.  */
+
+static unsigned int
+go_append_padding (struct obstack *ob, unsigned int from_offset,
+		   unsigned int to_offset, unsigned int align_units,
+		   unsigned int index, unsigned int *ret_offset)
+{
+  if (from_offset % align_units > 0)
+    from_offset += align_units - (from_offset % align_units);
+  gcc_assert (to_offset >= from_offset);
+  if (to_offset > from_offset)
+    {
+      char buf[100];
+
+      index = go_append_artificial_name (ob, index);
+      snprintf (buf, sizeof buf, "_pad [%u]byte; ", to_offset - from_offset);
+      obstack_grow (ob, buf, strlen (buf));
+    }
+  *ret_offset = to_offset;
+
+  return index;
+}
+
+/* Appends an array of type TYPE_STRING with zero elements and the name
+   "Godump_INDEX_align" to OB.  If TYPE_STRING is a null pointer, ERROR_STRING
+   is appended instead of the type.  Returns INDEX + 1.  */
+
+static unsigned int
+go_force_record_alignment (struct obstack *ob, const char *type_string,
+			   unsigned int index, const char *error_string)
+{
+  index = go_append_artificial_name (ob, index);
+  obstack_grow (ob, "_align ", 7);
+  if (type_string == NULL)
+    {
+      obstack_grow (ob, error_string, strlen (error_string));
+    }
+  else
+    {
+      obstack_grow (ob, "[0]", 3);
+      obstack_grow (ob, type_string, strlen (type_string));
+    }
+  obstack_grow (ob, "; ", 2);
+
+  return index;
+}
+
 /* Write the Go version of TYPE to CONTAINER->TYPE_OBSTACK.
    USE_TYPE_NAME is true if we can simply use a type name here without
    needing to define it.  IS_FUNC_OK is true if we can output a func
-   type here; the "func" keyword will already have been added.  Return
-   true if the type can be represented in Go, false otherwise.  */
+   type here; the "func" keyword will already have been added.  If IS_NESTED is
+   true, the type is contained in a record or union.  Return true if the type
+   can be represented in Go, false otherwise.  */
 
 static bool
 go_format_type (struct godump_container *container, tree type,
-		bool use_type_name, bool is_func_ok)
+		bool use_type_name, bool is_func_ok, bool is_nested)
 {
   bool ret;
   struct obstack *ob;
+  static unsigned int art_i = 0;
 
+  if (is_nested == false)
+    art_i = 0;
   ret = true;
   ob = &container->type_obstack;
 
@@ -618,27 +738,15 @@ go_format_type (struct godump_container *container, tree type,
 	const char *s;
 	char buf[100];
 
-	switch (TYPE_PRECISION (type))
+	s = go_get_uinttype_for_precision
+	  (TYPE_PRECISION (type), TYPE_UNSIGNED (type));
+	if (s == NULL)
 	  {
-	  case 8:
-	    s = TYPE_UNSIGNED (type) ? "uint8" : "int8";
-	    break;
-	  case 16:
-	    s = TYPE_UNSIGNED (type) ? "uint16" : "int16";
-	    break;
-	  case 32:
-	    s = TYPE_UNSIGNED (type) ? "uint32" : "int32";
-	    break;
-	  case 64:
-	    s = TYPE_UNSIGNED (type) ? "uint64" : "int64";
-	    break;
-	  default:
 	    snprintf (buf, sizeof buf, "INVALID-int-%u%s",
 		      TYPE_PRECISION (type),
 		      TYPE_UNSIGNED (type) ? "u" : "");
 	    s = buf;
 	    ret = false;
-	    break;
 	  }
 	obstack_grow (ob, s, strlen (s));
       }
@@ -710,7 +818,7 @@ go_format_type (struct godump_container *container, tree type,
       else
 	{
 	  if (!go_format_type (container, TREE_TYPE (type), use_type_name,
-			       true))
+			       true, false))
 	    ret = false;
 	}
       break;
@@ -732,64 +840,60 @@ go_format_type (struct godump_container *container, tree type,
 		    tree_to_shwi (TYPE_MAX_VALUE (TYPE_DOMAIN (type))));
 	  obstack_grow (ob, buf, strlen (buf));
 	}
+      else
+	obstack_1grow (ob, '0');
       obstack_1grow (ob, ']');
-      if (!go_format_type (container, TREE_TYPE (type), use_type_name, false))
+      if (!go_format_type (container, TREE_TYPE (type), use_type_name, false,
+			   false))
 	ret = false;
       break;
 
-    case UNION_TYPE:
     case RECORD_TYPE:
       {
+	unsigned int prev_field_end;
+	unsigned int most_strict_known_alignment;
 	tree field;
-	int i;
 
+	layout_type (type);
+	prev_field_end = 0;
+	most_strict_known_alignment = 1;
 	obstack_grow (ob, "struct { ", 9);
-	i = 0;
 	for (field = TYPE_FIELDS (type);
 	     field != NULL_TREE;
 	     field = TREE_CHAIN (field))
 	  {
-	    struct obstack hold_type_obstack;
 	    bool field_ok;
 
-	    if (TREE_CODE (type) == UNION_TYPE)
-	      {
-		hold_type_obstack = container->type_obstack;
-		obstack_init (&container->type_obstack);
-	      }
-
+	    if (TREE_CODE (field) != FIELD_DECL)
+	      continue;
 	    field_ok = true;
-
-	    if (DECL_NAME (field) == NULL)
-	      {
-		char buf[100];
-
-		obstack_grow (ob, "Godump_", 7);
-		snprintf (buf, sizeof buf, "%d", i);
-		obstack_grow (ob, buf, strlen (buf));
-		i++;
-	      }
-	    else
-              {
-		const char *var_name;
-		void **slot;
-
-		/* Start variable name with an underscore if a keyword.  */
-		var_name = IDENTIFIER_POINTER (DECL_NAME (field));
-		slot = htab_find_slot (container->keyword_hash, var_name,
-				       NO_INSERT);
-		if (slot != NULL)
-		  obstack_1grow (ob, '_');
-		go_append_string (ob, DECL_NAME (field));
-	      }
-	    obstack_1grow (ob, ' ');
 	    if (DECL_BIT_FIELD (field))
-	      {
-		obstack_grow (ob, "INVALID-bit-field", 17);
-		field_ok = false;
-	      }
+	      continue;
 	    else
               {
+		{
+		  unsigned int decl_align_unit;
+		  unsigned int decl_offset;
+
+		  decl_align_unit = precision_to_units (DECL_ALIGN (field));
+		  decl_offset =
+		    TREE_INT_CST_LOW (DECL_FIELD_OFFSET (field))
+		    + precision_to_units
+		    (TREE_INT_CST_LOW (DECL_FIELD_BIT_OFFSET (field)));
+		  if (decl_align_unit > most_strict_known_alignment)
+		    most_strict_known_alignment = decl_align_unit;
+		  art_i = go_append_padding
+		    (ob, prev_field_end, decl_offset, decl_align_unit, art_i,
+		     &prev_field_end);
+		  if (DECL_SIZE_UNIT (field))
+		    prev_field_end += TREE_INT_CST_LOW (DECL_SIZE_UNIT (field));
+		}
+		if (DECL_NAME (field) == NULL)
+		  art_i = go_append_artificial_name (ob, art_i);
+		else
+		  go_append_decl_name (ob, field, container->keyword_hash);
+		obstack_1grow (ob, ' ');
+
 		/* Do not expand type if a record or union type or a
 		   function pointer.  */
 		if (TYPE_NAME (TREE_TYPE (field)) != NULL_TREE
@@ -815,40 +919,76 @@ go_format_type (struct godump_container *container, tree type,
 		else
 		  {
 		    if (!go_format_type (container, TREE_TYPE (field), true,
-					 false))
+					 false, true))
 		      field_ok = false;
 		  }
+		obstack_grow (ob, "; ", 2);
               }
-	    obstack_grow (ob, "; ", 2);
+	    if (!field_ok)
+	      ret = false;
+	  }
+	/* Alignment and padding as necessary.  */
+	{
+	  unsigned int type_align_unit;
+
+	  type_align_unit = precision_to_units (TYPE_ALIGN (type));
+	  /* Padding.  */
+	  art_i = go_append_padding
+	    (ob, prev_field_end, TREE_INT_CST_LOW (TYPE_SIZE_UNIT (type)),
+	     type_align_unit, art_i, &prev_field_end);
+	  if (most_strict_known_alignment < type_align_unit)
+	  {
+	    const char *s;
+	    char buf[100];
 
-	    /* Only output the first successful field of a union, and
-	       hope for the best.  */
-	    if (TREE_CODE (type) == UNION_TYPE)
+	    /* Enforce proper record alignment.  */
+	    s = go_get_uinttype_for_precision
+	      (TYPE_ALIGN (type), TYPE_UNSIGNED (type));
+	    if (s == NULL)
 	      {
-		if (!field_ok && TREE_CHAIN (field) == NULL_TREE)
-		  {
-		    field_ok = true;
-		    ret = false;
-		  }
-		if (field_ok)
-		  {
-		    unsigned int sz;
-
-		    sz = obstack_object_size (&container->type_obstack);
-		    obstack_grow (&hold_type_obstack,
-				  obstack_base (&container->type_obstack),
-				  sz);
-		  }
-		obstack_free (&container->type_obstack, NULL);
-		container->type_obstack = hold_type_obstack;
-		if (field_ok)
-		  break;
+		snprintf (buf, sizeof buf, "INVALID-int-%u%s",
+			  TYPE_ALIGN (type), TYPE_UNSIGNED (type) ? "u" : "");
+		s = buf;
+		ret = false;
 	      }
+	    art_i = go_force_record_alignment (ob, s, art_i, buf);
+	  }
+	}
+	obstack_1grow (ob, '}');
+      }
+      break;
+
+    case UNION_TYPE:
+      {
+	const char *s;
+	unsigned int sz_units;
+
+	layout_type (type);
+	sz_units = TREE_INT_CST_LOW (TYPE_SIZE_UNIT (type));
+	s = go_get_uinttype_for_precision (TYPE_ALIGN (type), true);
+	obstack_grow (ob, "struct { ", 9);
+	if (s == NULL)
+	  {
+	    ret = false;
+	    s = "INVALID-union-alignment";
+	    obstack_grow (ob, s, strlen (s));
+	  }
+	else
+	  {
+	    char buf[100];
+	    tree field;
+
+	    field = TYPE_FIELDS (type);
+	    /* Use the same index as the byte field's artificial name for
+	       padding.  */
+	    if (field != NULL_TREE && DECL_NAME (field) != NULL)
+	      go_append_decl_name (ob, field, container->keyword_hash);
 	    else
-	      {
-		if (!field_ok)
-		  ret = false;
-	      }
+	      art_i = go_append_artificial_name (ob, art_i);
+	    obstack_grow (ob, " [", 2);
+	    snprintf (buf, sizeof buf, "%u", sz_units);
+	    obstack_grow (ob, buf, strlen (buf));
+	    obstack_grow (ob, "]byte; ", 7);
 	  }
 	obstack_1grow (ob, '}');
       }
@@ -879,7 +1019,7 @@ go_format_type (struct godump_container *container, tree type,
 	      break;
 	    if (seen_arg)
 	      obstack_grow (ob, ", ", 2);
-	    if (!go_format_type (container, arg_type, true, false))
+	    if (!go_format_type (container, arg_type, true, false, false))
 	      ret = false;
 	    seen_arg = true;
 	  }
@@ -895,7 +1035,8 @@ go_format_type (struct godump_container *container, tree type,
 	if (!VOID_TYPE_P (result))
 	  {
 	    obstack_1grow (ob, ' ');
-	    if (!go_format_type (container, result, use_type_name, false))
+	    if (!go_format_type (container, result, use_type_name, false,
+				 false))
 	      ret = false;
 	  }
       }
@@ -929,7 +1070,7 @@ go_output_type (struct godump_container *container)
 static void
 go_output_fndecl (struct godump_container *container, tree decl)
 {
-  if (!go_format_type (container, TREE_TYPE (decl), false, true))
+  if (!go_format_type (container, TREE_TYPE (decl), false, true, false))
     fprintf (go_dump_file, "// ");
   fprintf (go_dump_file, "func _%s ",
 	   IDENTIFIER_POINTER (DECL_NAME (decl)));
@@ -1004,7 +1145,7 @@ go_output_typedef (struct godump_container *container, tree decl)
 	return;
       *slot = CONST_CAST (void *, (const void *) type);
 
-      if (!go_format_type (container, TREE_TYPE (decl), false, false))
+      if (!go_format_type (container, TREE_TYPE (decl), false, false, false))
 	{
 	  fprintf (go_dump_file, "// ");
 	  slot = htab_find_slot (container->invalid_hash, type, INSERT);
@@ -1040,7 +1181,7 @@ go_output_typedef (struct godump_container *container, tree decl)
          return;
        *slot = CONST_CAST (void *, (const void *) type);
 
-       if (!go_format_type (container, TREE_TYPE (decl), false, false))
+       if (!go_format_type (container, TREE_TYPE (decl), false, false, false))
 	 {
 	   fprintf (go_dump_file, "// ");
 	   slot = htab_find_slot (container->invalid_hash, type, INSERT);
@@ -1069,6 +1210,8 @@ static void
 go_output_var (struct godump_container *container, tree decl)
 {
   bool is_valid;
+  tree type_name;
+  tree id;
 
   if (container->decls_seen.contains (decl)
       || container->decls_seen.contains (DECL_NAME (decl)))
@@ -1076,7 +1219,34 @@ go_output_var (struct godump_container *container, tree decl)
   container->decls_seen.add (decl);
   container->decls_seen.add (DECL_NAME (decl));
 
-  is_valid = go_format_type (container, TREE_TYPE (decl), true, false);
+  type_name = TYPE_NAME (TREE_TYPE (decl));
+  id = NULL_TREE;
+  if (type_name != NULL_TREE && TREE_CODE (type_name) == IDENTIFIER_NODE)
+    id = type_name;
+  else if (type_name != NULL_TREE && TREE_CODE (type_name) == TYPE_DECL
+	   && DECL_SOURCE_LOCATION (type_name) != BUILTINS_LOCATION
+	   && DECL_NAME (type_name))
+    id = DECL_NAME (type_name);
+  if (id != NULL_TREE &&
+      (  !htab_find_slot (container->type_hash, IDENTIFIER_POINTER (id),
+			  NO_INSERT)
+       || htab_find_slot (container->invalid_hash, IDENTIFIER_POINTER (id),
+			  NO_INSERT)))
+    {
+      id = NULL_TREE;
+    }
+  if (id != NULL_TREE)
+    {
+      struct obstack *ob;
+
+      ob = &container->type_obstack;
+      obstack_1grow (ob, '_');
+      go_append_string (ob, id);
+      is_valid = htab_find_slot (container->type_hash, IDENTIFIER_POINTER (id),
+				 NO_INSERT) != NULL;
+    }
+  else
+    is_valid = go_format_type (container, TREE_TYPE (decl), true, false, false);
   if (is_valid
       && htab_find_slot (container->type_hash,
 			 IDENTIFIER_POINTER (DECL_NAME (decl)),
@@ -1096,10 +1266,8 @@ go_output_var (struct godump_container *container, tree decl)
 
   /* Sometimes an extern variable is declared with an unknown struct
      type.  */
-  if (TYPE_NAME (TREE_TYPE (decl)) != NULL_TREE
-      && RECORD_OR_UNION_TYPE_P (TREE_TYPE (decl)))
+  if (type_name != NULL_TREE && RECORD_OR_UNION_TYPE_P (TREE_TYPE (decl)))
     {
-      tree type_name = TYPE_NAME (TREE_TYPE (decl));
       if (TREE_CODE (type_name) == IDENTIFIER_NODE)
 	container->pot_dummy_types.add (IDENTIFIER_POINTER (type_name));
       else if (TREE_CODE (type_name) == TYPE_DECL)
diff --git a/gcc/testsuite/gcc.misc-tests/godump-1.c b/gcc/testsuite/gcc.misc-tests/godump-1.c
new file mode 100644
index 0000000..2a8a0fd
--- /dev/null
+++ b/gcc/testsuite/gcc.misc-tests/godump-1.c
@@ -0,0 +1,472 @@
+/* Test -fdump-go-specs option.  */
+
+/* { dg-options "-c -fdump-go-spec=godump-1.out" } */
+/* { dg-do compile } */
+
+#include <stdint.h>
+
+/* integer based types */
+typedef char c_t;
+char c_v1;
+c_t c_v2;
+typedef short s_t;
+short s_v1;
+s_t s_v2;
+typedef int i_t;
+int i_v1;
+i_t i_v2;
+typedef long l_t;
+long l_v1;
+l_t l_v2;
+typedef long long ll_t;
+long long ll_v1;
+ll_t ll_v2;
+typedef unsigned char uc_t;
+unsigned char uc_v1;
+uc_t uc_v2;
+typedef unsigned short us_t;
+unsigned short us_v1;
+us_t us_v2;
+typedef unsigned int ui_t;
+unsigned int ui_v1;
+ui_t ui_v2;
+typedef unsigned long ul_t;
+unsigned long ul_v1;
+ul_t ul_v2;
+typedef unsigned long long ull_t;
+unsigned long long ull_v1;
+ull_t ull_v2;
+typedef signed char sc_t;
+signed char sc_v1;
+sc_t sc_v2;
+typedef signed short ss_t;
+signed short ss_v1;
+ss_t ss_v2;
+typedef signed int si_t;
+signed int si_v1;
+si_t si_v2;
+typedef signed long sl_t;
+signed long sl_v1;
+sl_t sl_v2;
+typedef signed long long sll_t;
+signed long long sll_v1;
+sll_t sll_v2;
+typedef int8_t i8_t;
+int8_t i8_v1;
+i8_t i8_v2;
+typedef int16_t i16_t;
+int16_t i16_v1;
+i16_t i16_v2;
+typedef int32_t i32_t;
+int32_t i32_v1;
+i32_t i32_v2;
+typedef int64_t i64_t;
+int64_t i64_v1;
+i64_t i64_v2;
+typedef uint8_t ui8_t;
+uint8_t ui8_v1;
+ui8_t ui8_v2;
+typedef uint16_t iu16_t;
+uint16_t iu16_v1;
+iu16_t iu16_v2;
+typedef uint32_t iu32_t;
+uint32_t iu32_v1;
+iu32_t iu32_v2;
+typedef uint64_t iu64_t;
+uint64_t iu64_v1;
+iu64_t iu64_v2;
+typedef const char cc_t;
+const char cc_v1;
+cc_t cc_v2;
+
+/* pointer and array types */
+typedef void *vp_t;
+void *vp_v1;
+vp_t vp_v2;
+typedef int **ipp_t;
+int **ipp_v1;
+ipp_t ipp_v2;
+typedef char ca_t[];
+char ca_v1[]; /* { dg-warning "array 'ca_v1' assumed to have one element" } */
+char ca_v1b[2];
+ca_t ca_v2; /* { dg-warning "array 'ca_v2' assumed to have one element" } */
+typedef short sa2_t[2];
+short sa2_v1[2];
+sa2_t sa2_v2;
+
+/* floating point types */
+typedef float f_t;
+float f_v1;
+f_t f_v2;
+typedef double d_t;
+double d_v1;
+d_t d_v2;
+typedef long double ld_t;
+long double ld_v1;
+ld_t ld_v2;
+
+/* nested typedefs */
+typedef int ni_t;
+typedef ni_t ni2_t;
+ni2_t ni2_v2;
+typedef ni2_t ni3_t;
+ni3_t ni3_v2;
+
+/* enums */
+enum { E11 };
+enum { EV11 } e1_v1;
+enum { E21, E22 };
+enum { EV21, EV22 } e2_v1;
+enum { EN1 = 3, EN2 = 77, EN3 = -1, EN4 };
+typedef enum { ET1, ET2 } et_t;
+enum { ETV1, ETV2 } et_v1;
+et_t et_v2;
+
+/* simple structs */
+typedef struct { } ts0e;
+struct { } s0e;
+typedef struct { int8_t e1; } ts1e;
+struct { int8_t e1; } s1e;
+typedef struct { int8_t e1; void *e2; } ts2el;
+struct { int8_t e1; void *e2; } s2el;
+typedef struct { void *e1; int8_t e2; } ts2eg;
+struct { void *e1; int8_t e2; } s2eg;
+typedef struct { int64_t l; int8_t c; int32_t i; int16_t s; } tsme;
+struct { int64_t l; int8_t c; int32_t i; int16_t s; } sme;
+typedef struct { int16_t sa[3]; int8_t ca[3]; } tsae;
+struct { int16_t sa[3]; int8_t ca[3]; } sae;
+typedef struct { float f; } tsf_equiv;
+struct { float f; } sf_equiv;
+typedef struct { float f; uint8_t : 0; } tsf_not_equiv;
+struct { float f; uint8_t : 0; } sf_not_equiv;
+typedef struct { double d; } tsd_equiv;
+struct { double d; } sd_equiv;
+typedef struct { double d; uint8_t : 0; } tsd_not_equiv;
+struct { double d; uint8_t : 0; } sd_not_equiv;
+
+/* nested structs */
+typedef struct { struct { uint8_t ca[3]; } s; uint32_t i; } tsn;
+struct { struct { uint8_t ca[3]; } s; uint32_t i; } sn;
+typedef struct { struct { uint8_t a; uint16_t s; }; uint8_t b; } tsn_anon;
+struct { struct { uint8_t a; uint16_t s; }; uint8_t b; } sn_anon;
+
+/* structs with bitfields */
+typedef struct { uint8_t : 0; uint8_t c; } tsbf_anon_pad1;
+struct { uint8_t : 0; uint8_t c; } sbf_anon_pad1;
+typedef struct { uint8_t : 1; uint8_t c; } tsbf_anon_pad2;
+struct { uint8_t : 1; uint8_t c; } sbf_anon_pad2;
+typedef struct { uint8_t : 7; uint8_t c; } tsbf_anon_pad3;
+struct { uint8_t : 7; uint8_t c; } sbf_anon_pad3;
+typedef struct { uint8_t : 8; uint8_t c; } tsbf_anon_pad4;
+struct { uint8_t : 8; uint8_t c; } sbf_anon_pad4;
+typedef struct { uint64_t : 0; uint8_t c; } tsbf_anon_pad5;
+struct { uint64_t : 0; uint8_t c; } sbf_anon_pad5;
+typedef struct { uint64_t : 1; uint8_t c; } tsbf_anon_pad6;
+struct { uint64_t : 1; uint8_t c; } sbf_anon_pad6;
+typedef struct { uint64_t : 63; uint8_t c; } tsbf_anon_pad7;
+struct { uint64_t : 63; uint8_t c; } sbf_anon_pad7;
+typedef struct { uint64_t : 64; uint8_t c; } tsbf_anon_pad8;
+struct { uint64_t : 64; uint8_t c; } sbf_anon_pad8;
+typedef struct { uint8_t bf : 1; uint8_t c; } tsbf_pad8_1;
+struct { uint8_t bf : 1; uint8_t c; } sbf_pad8_1;
+typedef struct { uint8_t bf : 7; uint8_t c; } tsbf_pad8_2;
+struct { uint8_t bf : 7; uint8_t c; } sbf_pad8_2;
+typedef struct { uint8_t bf : 8; uint8_t c; } tsbf_pad8_3;
+struct { uint8_t bf : 8; uint8_t c; } sbf_pad8_3;
+typedef struct { uint16_t bf : 1; uint8_t c; } tsbf_pad16_1;
+struct { uint16_t bf : 1; uint8_t c; } sbf_pad16_1;
+typedef struct { uint16_t bf : 15; uint8_t c; } tsbf_pad16_2;
+struct { uint16_t bf : 15; uint8_t c; } sbf_pad16_2;
+typedef struct { uint16_t bf : 16; uint8_t c; } tsbf_pad16_3;
+struct { uint16_t bf : 16; uint8_t c; } sbf_pad16_3;
+typedef struct { uint32_t bf : 1; uint8_t c; } tsbf_pad32_1;
+struct { uint32_t bf : 1; uint8_t c; } sbf_pad32_1;
+typedef struct { uint32_t bf : 31; uint8_t c; } tsbf_pad32_2;
+struct { uint32_t bf : 31; uint8_t c; } sbf_pad32_2;
+typedef struct { uint32_t bf : 32; uint8_t c; } tsbf_pad32_3;
+struct { uint32_t bf : 32; uint8_t c; } sbf_pad32_3;
+typedef struct { uint64_t bf : 1; uint8_t c; } tsbf_pad64_1;
+struct { uint64_t bf : 1; uint8_t c; } sbf_pad64_1;
+typedef struct { uint64_t bf : 63; uint8_t c; } tsbf_pad64_2;
+struct { uint64_t bf : 63; uint8_t c; } sbf_pad64_2;
+typedef struct { uint64_t bf : 64; uint8_t c; } tsbf_pad64_3;
+struct { uint64_t bf : 64; uint8_t c; } sbf_pad64_3;
+typedef struct { uint8_t b1 : 1; } tsbf_1b;
+struct { uint8_t b1 : 1; } sbf_1b;
+typedef struct
+{
+  uint8_t b1 : 1; uint8_t b2 : 1; uint8_t b3 : 1; uint8_t b4 : 1;
+  uint8_t b5 : 1; uint8_t b6 : 1; uint8_t b7 : 1; uint8_t b8 : 1;
+} tsbf_8b;
+struct
+{
+  uint8_t b1 : 1; uint8_t b2 : 1; uint8_t b3 : 1; uint8_t b4 : 1;
+  uint8_t b5 : 1; uint8_t b6 : 1; uint8_t b7 : 1; uint8_t b8 : 1;
+} sbf_8b;
+typedef struct {
+  uint8_t b1 : 1; uint8_t b2 : 1; uint8_t b3 : 1; uint8_t b4 : 1;
+  uint8_t b5 : 1; uint8_t b6 : 1; uint8_t b7 : 1; uint8_t b8 : 1;
+  uint8_t b9 : 1;
+} tsbf_9b;
+struct {
+  uint8_t b1 : 1; uint8_t b2 : 1; uint8_t b3 : 1; uint8_t b4 : 1;
+  uint8_t b5 : 1; uint8_t b6 : 1; uint8_t b7 : 1; uint8_t b8 : 1;
+  uint8_t b9 : 1;
+} sbf_9b;
+typedef struct {
+  uint8_t b1 : 7; uint8_t b2 : 7; uint8_t b3 : 2;
+} tsbf_18b;
+struct {
+  uint8_t b1 : 7; uint8_t b2 : 7; uint8_t b3 : 2;
+} sbf_18b;
+struct
+{
+  uint16_t bf1 : 8;
+  uint8_t c;
+  uint16_t bf2 : 8;
+  uint32_t bf3 : 12;
+  uint16_t s;
+} sbf_gaps;
+typedef struct
+{
+  uint16_t bf1 : 8;
+  uint8_t c;
+  uint16_t bf2 : 8;
+  uint32_t bf3 : 12;
+  uint16_t s;
+} tsbf_gaps;
+
+/* unions */
+typedef union { } tue;
+union { } ue;
+typedef union { uint8_t c; uint64_t l; } tu1;
+union { uint8_t c; uint64_t l; } u1;
+typedef union { uint64_t l; uint8_t c; } tu2;
+union { uint64_t l; uint8_t c; } u2;
+typedef struct { union { uint8_t c; uint64_t l; }; } tsu_anon;
+struct { union { uint8_t c; uint64_t l; }; } su_anon;
+typedef union { uint64_t bf : 1; uint8_t ca[5]; } tu_size;
+union { uint64_t bf : 1; uint8_t ca[5]; } u_size;
+typedef union { uint64_t : 1; uint8_t ca[5]; } tu2_size;
+union { uint64_t : 1; uint8_t ca[5]; } u2_size;
+
+/* functions */
+extern uint32_t func1(uint8_t c);
+typedef int8_t (*func_t)(void *p);
+
+/* Necessary quoting in the regexp patters:
+
+     (?n) at beginning of pattern to make ^ and $ work.
+     "     ->  \"
+     *, +  ->  "*", "+"
+     [, ]  ->  "\[", "\]"
+     (, )  ->  "\[(\]", "\[)\]"
+     {, }  ->  "\{", "\}"
+*/
+
+/* { dg-final { scan-file godump-1.out "(?n)^type _c_t u?int\[0-9\]*$" } } */
+/* { dg-final { scan-file godump-1.out "(?n)^type _s_t int\[0-9\]*$" } } */
+/* { dg-final { scan-file godump-1.out "(?n)^type _i_t int\[0-9\]*$" } } */
+/* { dg-final { scan-file godump-1.out "(?n)^type _l_t int\[0-9\]*$" } } */
+/* { dg-final { scan-file godump-1.out "(?n)^type _ll_t int\[0-9\]*$" } } */
+/* { dg-final { scan-file godump-1.out "(?n)^type _uc_t uint\[0-9\]*$" } } */
+/* { dg-final { scan-file godump-1.out "(?n)^type _us_t uint\[0-9\]*$" } } */
+/* { dg-final { scan-file godump-1.out "(?n)^type _ui_t uint\[0-9\]*$" } } */
+/* { dg-final { scan-file godump-1.out "(?n)^type _ul_t uint\[0-9\]*$" } } */
+/* { dg-final { scan-file godump-1.out "(?n)^type _ull_t uint\[0-9\]*$" } } */
+/* { dg-final { scan-file godump-1.out "(?n)^type _sc_t int\[0-9\]*$" } } */
+/* { dg-final { scan-file godump-1.out "(?n)^type _ss_t int\[0-9\]*$" } } */
+/* { dg-final { scan-file godump-1.out "(?n)^type _si_t int\[0-9\]*$" } } */
+/* { dg-final { scan-file godump-1.out "(?n)^type _sl_t int\[0-9\]*$" } } */
+/* { dg-final { scan-file godump-1.out "(?n)^type _sll_t int\[0-9\]*$" } } */
+/* { dg-final { scan-file godump-1.out "(?n)^type _i8_t int\[0-9\]*$" } } */
+/* { dg-final { scan-file godump-1.out "(?n)^type _i16_t int\[0-9\]*$" } } */
+/* { dg-final { scan-file godump-1.out "(?n)^type _i32_t int\[0-9\]*$" } } */
+/* { dg-final { scan-file godump-1.out "(?n)^type _i64_t int\[0-9\]*$" } } */
+/* { dg-final { scan-file godump-1.out "(?n)^type _ui8_t uint\[0-9\]*$" } } */
+/* { dg-final { scan-file godump-1.out "(?n)^type _iu16_t uint\[0-9\]*$" } } */
+/* { dg-final { scan-file godump-1.out "(?n)^type _iu32_t uint\[0-9\]*$" } } */
+/* { dg-final { scan-file godump-1.out "(?n)^type _iu64_t uint\[0-9\]*$" } } */
+/* { dg-final { scan-file godump-1.out "(?n)^type _cc_t u?int\[0-9\]*$" } } */
+/* { dg-final { scan-file godump-1.out "(?n)^type _vp_t \\*byte$" } } */
+/* { dg-final { scan-file godump-1.out "(?n)^type _ipp_t \\*\\*int\[0-9\]*$" } } */
+/* { dg-final { scan-file godump-1.out "(?n)^type _ca_t \\\[0\\\]uint\[0-9\]*$" } } */
+/* { dg-final { scan-file godump-1.out "(?n)^type _sa2_t \\\[1\\+1\\\]int\[0-9\]*$" } } */
+/* { dg-final { scan-file godump-1.out "(?n)^type _f_t float\[0-9\]*$" } } */
+/* { dg-final { scan-file godump-1.out "(?n)^type _d_t float\[0-9\]*$" } } */
+/* { dg-final { scan-file godump-1.out "(?n)^// type _ld_t INVALID-float-128$" } } */
+/* { dg-final { scan-file godump-1.out "(?n)^type _ni_t int\[0-9\]*$" } } */
+/* { dg-final { scan-file godump-1.out "(?n)^type _ni2_t int\[0-9\]*$" } } */
+/* { dg-final { scan-file godump-1.out "(?n)^type _ni3_t int\[0-9\]*$" } } */
+/* { dg-final { scan-file godump-1.out "(?n)^type _et_t int$" } } */
+/* { dg-final { scan-file godump-1.out "(?n)^type _ts0e struct \{ \}$" } } */
+/* { dg-final { scan-file godump-1.out "(?n)^type _ts1e struct \{ e1 int\[0-9\]*; \}$" } } */
+/* { dg-final { scan-file godump-1.out "(?n)^type _ts2el struct \{ e1 int\[0-9\]*; e2 \\*byte; \}$" } } */
+/* { dg-final { scan-file godump-1.out "(?n)^type _ts2eg struct \{ e1 \\*byte; e2 int\[0-9\]*; \}$" } } */
+/* { dg-final { scan-file godump-1.out "(?n)^type _tsme struct \{ l int\[0-9\]*; c int\[0-9\]*; i int\[0-9\]*; s int\[0-9\]*; \}$" } } */
+/* { dg-final { scan-file godump-1.out "(?n)^type _tsae struct \{ sa \\\[2\\+1\\\]int\[0-9\]*; ca \\\[2\\+1\\\]int\[0-9\]*; \}$" } } */
+/* { dg-final { scan-file godump-1.out "(?n)^type _tsf_equiv struct \{ f float\[0-9\]*; \}$" } } */
+/* { dg-final { scan-file godump-1.out "(?n)^type _tsf_not_equiv struct \{ f float\[0-9\]*; \}$" } } */
+/* { dg-final { scan-file godump-1.out "(?n)^type _tsd_equiv struct \{ d float\[0-9\]*; \}$" } } */
+/* { dg-final { scan-file godump-1.out "(?n)^type _tsd_not_equiv struct \{ d float\[0-9\]*; \}$" } } */
+/* { dg-final { scan-file godump-1.out "(?n)^type _tsn struct \{ s struct \{ ca \\\[2\\+1\\\]uint\[0-9\]*; \}; i uint\[0-9\]*; \}$" } } */
+/* { dg-final { scan-file godump-1.out "(?n)^type _tsn_anon struct \{ Godump_0 struct \{ a uint\[0-9\]*; s uint\[0-9\]*; \}; b uint\[0-9\]*; \}$" } } */
+/* { dg-final { scan-file godump-1.out "(?n)^type _tsbf_anon_pad1 struct \{ c uint\[0-9\]*; \}$" } } */
+/* { dg-final { scan-file godump-1.out "(?n)^type _tsbf_anon_pad2 struct \{ Godump_0_pad \\\[1\\\]byte; c uint\[0-9\]*; \}$" } } */
+/* { dg-final { scan-file godump-1.out "(?n)^type _tsbf_anon_pad3 struct \{ Godump_0_pad \\\[1\\\]byte; c uint\[0-9\]*; \}$" } } */
+/* { dg-final { scan-file godump-1.out "(?n)^type _tsbf_anon_pad4 struct \{ Godump_0 uint\[0-9\]*; c uint\[0-9\]*; \}$" } } */
+/* { dg-final { scan-file godump-1.out "(?n)^type _tsbf_anon_pad5 struct \{ c uint\[0-9\]*; \}$" } } */
+/* { dg-final { scan-file godump-1.out "(?n)^type _tsbf_anon_pad6 struct \{ Godump_0_pad \\\[1\\\]byte; c uint\[0-9\]*; \}$" } } */
+/* { dg-final { scan-file godump-1.out "(?n)^type _tsbf_anon_pad7 struct \{ Godump_0_pad \\\[8\\\]byte; c uint\[0-9\]*; \}$" } } */
+/* { dg-final { scan-file godump-1.out "(?n)^type _tsbf_anon_pad8 struct \{ Godump_0 uint\[0-9\]*; c uint\[0-9\]*; \}$" } } */
+/* { dg-final { scan-file godump-1.out "(?n)^type _tsbf_pad8_1 struct \{ Godump_0_pad \\\[1\\\]byte; c uint\[0-9\]*; \}$" } } */
+/* { dg-final { scan-file godump-1.out "(?n)^type _tsbf_pad8_2 struct \{ Godump_0_pad \\\[1\\\]byte; c uint\[0-9\]*; \}$" } } */
+/* { dg-final { scan-file godump-1.out "(?n)^type _tsbf_pad8_3 struct \{ bf uint\[0-9\]*; c uint\[0-9\]*; \}$" } } */
+/* { dg-final { scan-file godump-1.out "(?n)^type _tsbf_pad16_1 struct \{ Godump_0_pad \\\[1\\\]byte; c uint\[0-9\]*; Godump_1_align \\\[0\\\]int\[0-9\]*; \}$" } } */
+/* { dg-final { scan-file godump-1.out "(?n)^type _tsbf_pad16_2 struct \{ Godump_0_pad \\\[2\\\]byte; c uint\[0-9\]*; Godump_1_align \\\[0\\\]int\[0-9\]*; \}$" } } */
+/* { dg-final { scan-file godump-1.out "(?n)^type _tsbf_pad16_3 struct \{ bf uint\[0-9\]*; c uint\[0-9\]*; \}$" } } */
+/* { dg-final { scan-file godump-1.out "(?n)^type _tsbf_pad32_1 struct \{ Godump_0_pad \\\[1\\\]byte; c uint\[0-9\]*; Godump_1_align \\\[0\\\]int\[0-9\]*; \}$" } } */
+/* { dg-final { scan-file godump-1.out "(?n)^type _tsbf_pad32_2 struct \{ Godump_0_pad \\\[4\\\]byte; c uint\[0-9\]*; Godump_1_align \\\[0\\\]int\[0-9\]*; \}$" } } */
+/* { dg-final { scan-file godump-1.out "(?n)^type _tsbf_pad32_3 struct \{ bf uint\[0-9\]*; c uint\[0-9\]*; \}$" } } */
+/* { dg-final { scan-file godump-1.out "(?n)^type _tsbf_pad64_1 struct \{ Godump_0_pad \\\[1\\\]byte; c uint\[0-9\]*; Godump_1_align \\\[0\\\]int\[0-9\]*; \}$" } } */
+/* { dg-final { scan-file godump-1.out "(?n)^type _tsbf_pad64_2 struct \{ Godump_0_pad \\\[8\\\]byte; c uint\[0-9\]*; Godump_1_align \\\[0\\\]int\[0-9\]*; \}$" } } */
+/* { dg-final { scan-file godump-1.out "(?n)^type _tsbf_pad64_3 struct \{ bf uint\[0-9\]*; c uint\[0-9\]*; \}$" } } */
+/* { dg-final { scan-file godump-1.out "(?n)^type _tsbf_1b struct \{ Godump_0_pad \\\[1\\\]byte; \}$" } } */
+/* { dg-final { scan-file godump-1.out "(?n)^type _tsbf_8b struct \{ Godump_0_pad \\\[1\\\]byte; \}$" } } */
+/* { dg-final { scan-file godump-1.out "(?n)^type _tsbf_9b struct \{ Godump_0_pad \\\[2\\\]byte; \}$" } } */
+/* { dg-final { scan-file godump-1.out "(?n)^type _tsbf_18b struct \{ Godump_0_pad \\\[3\\\]byte; \}$" } } */
+/* { dg-final { scan-file godump-1.out "(?n)^type _tsbf_gaps struct \{ bf1 uint\[0-9\]*; c uint\[0-9\]*; bf2 uint\[0-9\]*; Godump_0_pad \\\[2\\\]byte; s uint\[0-9\]*; Godump_1_align \\\[0\\\]int\[0-9\]*; \}$" } } */
+/* { dg-final { scan-file godump-1.out "(?n)^type _tue struct \{ Godump_0 \\\[0\\\]byte; \}$" } } */
+/* { dg-final { scan-file godump-1.out "(?n)^type _tu1 struct \{ c \\\[8\\\]byte; \}$" } } */
+/* { dg-final { scan-file godump-1.out "(?n)^type _tu2 struct \{ l \\\[8\\\]byte; \}$" } } */
+/* { dg-final { scan-file godump-1.out "(?n)^type _tsu_anon struct \{ Godump_0 struct \{ c \\\[8\\\]byte; \}; \}$" } } */
+/* { dg-final { scan-file godump-1.out "(?n)^type _tu_size struct \{ bf \\\[8\\\]byte; \}$" } } */
+/* { dg-final { scan-file godump-1.out "(?n)^type _tu2_size struct \{ Godump_0 \\\[5\\\]byte; \}$" } } */
+/* { dg-final { scan-file godump-1.out "(?n)^type _func_t func\[(\]\\*byte\[)\] int\[0-9\]*$" } } */
+/* { dg-final { scan-file godump-1.out "(?n)^var _c_v1 u?int\[0-9\]*$" } } */
+/* { dg-final { scan-file godump-1.out "(?n)^var _c_v2 _c_t$" } } */
+/* { dg-final { scan-file godump-1.out "(?n)^var _s_v1 int\[0-9\]*$" } } */
+/* { dg-final { scan-file godump-1.out "(?n)^var _s_v2 _s_t$" } } */
+/* { dg-final { scan-file godump-1.out "(?n)^var _i_v1 int\[0-9\]*$" } } */
+/* { dg-final { scan-file godump-1.out "(?n)^var _i_v2 _i_t$" } } */
+/* { dg-final { scan-file godump-1.out "(?n)^var _l_v1 int\[0-9\]*$" } } */
+/* { dg-final { scan-file godump-1.out "(?n)^var _l_v2 _l_t$" } } */
+/* { dg-final { scan-file godump-1.out "(?n)^var _ll_v1 int\[0-9\]*$" } } */
+/* { dg-final { scan-file godump-1.out "(?n)^var _ll_v2 _ll_t$" } } */
+/* { dg-final { scan-file godump-1.out "(?n)^var _uc_v1 uint\[0-9\]*$" } } */
+/* { dg-final { scan-file godump-1.out "(?n)^var _uc_v2 _uc_t$" } } */
+/* { dg-final { scan-file godump-1.out "(?n)^var _us_v1 uint\[0-9\]*$" } } */
+/* { dg-final { scan-file godump-1.out "(?n)^var _us_v2 _us_t$" } } */
+/* { dg-final { scan-file godump-1.out "(?n)^var _ui_v1 uint\[0-9\]*$" } } */
+/* { dg-final { scan-file godump-1.out "(?n)^var _ui_v2 _ui_t$" } } */
+/* { dg-final { scan-file godump-1.out "(?n)^var _ul_v1 uint\[0-9\]*$" } } */
+/* { dg-final { scan-file godump-1.out "(?n)^var _ul_v2 _ul_t$" } } */
+/* { dg-final { scan-file godump-1.out "(?n)^var _ull_v1 uint\[0-9\]*$" } } */
+/* { dg-final { scan-file godump-1.out "(?n)^var _ull_v2 _ull_t$" } } */
+/* { dg-final { scan-file godump-1.out "(?n)^var _sc_v1 int\[0-9\]*$" } } */
+/* { dg-final { scan-file godump-1.out "(?n)^var _sc_v2 _sc_t$" } } */
+/* { dg-final { scan-file godump-1.out "(?n)^var _ss_v1 int\[0-9\]*$" } } */
+/* { dg-final { scan-file godump-1.out "(?n)^var _ss_v2 _ss_t$" } } */
+/* { dg-final { scan-file godump-1.out "(?n)^var _si_v1 int\[0-9\]*$" } } */
+/* { dg-final { scan-file godump-1.out "(?n)^var _si_v2 _si_t$" } } */
+/* { dg-final { scan-file godump-1.out "(?n)^var _sl_v1 int\[0-9\]*$" } } */
+/* { dg-final { scan-file godump-1.out "(?n)^var _sl_v2 _sl_t$" } } */
+/* { dg-final { scan-file godump-1.out "(?n)^var _sll_v1 int\[0-9\]*$" } } */
+/* { dg-final { scan-file godump-1.out "(?n)^var _sll_v2 _sll_t$" } } */
+/* { dg-final { scan-file godump-1.out "(?n)^var _i8_v1 _int8_t$" } } */
+/* { dg-final { scan-file godump-1.out "(?n)^var _i8_v2 _i8_t$" } } */
+/* { dg-final { scan-file godump-1.out "(?n)^var _i16_v1 _int16_t$" } } */
+/* { dg-final { scan-file godump-1.out "(?n)^var _i16_v2 _i16_t$" } } */
+/* { dg-final { scan-file godump-1.out "(?n)^var _i32_v1 _int32_t$" } } */
+/* { dg-final { scan-file godump-1.out "(?n)^var _i32_v2 _i32_t$" } } */
+/* { dg-final { scan-file godump-1.out "(?n)^var _i64_v1 _int64_t$" } } */
+/* { dg-final { scan-file godump-1.out "(?n)^var _i64_v2 _i64_t$" } } */
+/* { dg-final { scan-file godump-1.out "(?n)^var _ui8_v1 _uint8_t$" } } */
+/* { dg-final { scan-file godump-1.out "(?n)^var _ui8_v2 _ui8_t$" } } */
+/* { dg-final { scan-file godump-1.out "(?n)^var _iu16_v1 _uint16_t$" } } */
+/* { dg-final { scan-file godump-1.out "(?n)^var _iu16_v2 _iu16_t$" } } */
+/* { dg-final { scan-file godump-1.out "(?n)^var _iu32_v1 _uint32_t$" } } */
+/* { dg-final { scan-file godump-1.out "(?n)^var _iu32_v2 _iu32_t$" } } */
+/* { dg-final { scan-file godump-1.out "(?n)^var _iu64_v1 _uint64_t$" } } */
+/* { dg-final { scan-file godump-1.out "(?n)^var _iu64_v2 _iu64_t$" } } */
+/* { dg-final { scan-file godump-1.out "(?n)^var _cc_v1 u?int\[0-9\]*$" } } */
+/* { dg-final { scan-file godump-1.out "(?n)^var _cc_v2 _cc_t$" } } */
+/* { dg-final { scan-file godump-1.out "(?n)^var _vp_v1 \\*byte$" } } */
+/* { dg-final { scan-file godump-1.out "(?n)^var _vp_v2 _vp_t$" } } */
+/* { dg-final { scan-file godump-1.out "(?n)^var _ipp_v1 \\*\\*int\[0-9\]*$" } } */
+/* { dg-final { scan-file godump-1.out "(?n)^var _ipp_v2 _ipp_t$" } } */
+/* { dg-final { scan-file godump-1.out "(?n)^var _ca_v1 \\\[0\\+1\\\]uint\[0-9\]*$" } } */
+/* { dg-final { scan-file godump-1.out "(?n)^var _ca_v1b \\\[1\\+1\\\]uint\[0-9\]*$" } } */
+/* { dg-final { scan-file godump-1.out "(?n)^var _ca_v2 \\\[0\\+1\\\]uint\[0-9\]*$" } } */
+/* { dg-final { scan-file godump-1.out "(?n)^var _sa2_v1 \\\[1\\+1\\\]int\[0-9\]*$" } } */
+/* { dg-final { scan-file godump-1.out "(?n)^var _sa2_v2 _sa2_t$" } } */
+/* { dg-final { scan-file godump-1.out "(?n)^var _f_v1 float\[0-9\]*$" } } */
+/* { dg-final { scan-file godump-1.out "(?n)^var _f_v2 _f_t$" } } */
+/* { dg-final { scan-file godump-1.out "(?n)^var _d_v1 float\[0-9\]*$" } } */
+/* { dg-final { scan-file godump-1.out "(?n)^var _d_v2 _d_t$" } } */
+/* { dg-final { scan-file godump-1.out "(?n)^// var _ld_v1 INVALID-float-128$" } } */
+/* { dg-final { scan-file godump-1.out "(?n)^// var _ld_v2 INVALID-float-128$" } } */
+/* { dg-final { scan-file godump-1.out "(?n)^var _ni2_v2 _ni2_t$" } } */
+/* { dg-final { scan-file godump-1.out "(?n)^var _ni3_v2 _ni3_t$" } } */
+/* { dg-final { scan-file godump-1.out "(?n)^var _e1_v1 int$" } } */
+/* { dg-final { scan-file godump-1.out "(?n)^var _e2_v1 int$" } } */
+/* { dg-final { scan-file godump-1.out "(?n)^var _et_v1 int$" } } */
+/* { dg-final { scan-file godump-1.out "(?n)^var _et_v2 _et_t$" } } */
+/* { dg-final { scan-file godump-1.out "(?n)^var _s0e struct \{ \}$" } } */
+/* { dg-final { scan-file godump-1.out "(?n)^var _s1e struct \{ e1 int\[0-9\]*; \}$" } } */
+/* { dg-final { scan-file godump-1.out "(?n)^var _s2el struct \{ e1 int\[0-9\]*; e2 \\*byte; \}$" } } */
+/* { dg-final { scan-file godump-1.out "(?n)^var _s2eg struct \{ e1 \\*byte; e2 int\[0-9\]*; \}$" } } */
+/* { dg-final { scan-file godump-1.out "(?n)^var _sme struct \{ l int\[0-9\]*; c int\[0-9\]*; i int\[0-9\]*; s int\[0-9\]*; \}$" } } */
+/* { dg-final { scan-file godump-1.out "(?n)^var _sae struct \{ sa \\\[2\\+1\\\]int\[0-9\]*; ca \\\[2\\+1\\\]int\[0-9\]*; \}$" } } */
+/* { dg-final { scan-file godump-1.out "(?n)^var _sf_equiv struct \{ f float\[0-9\]*; \}$" } } */
+/* { dg-final { scan-file godump-1.out "(?n)^var _sf_not_equiv struct \{ f float\[0-9\]*; \}$" } } */
+/* { dg-final { scan-file godump-1.out "(?n)^var _sd_equiv struct \{ d float\[0-9\]*; \}$" } } */
+/* { dg-final { scan-file godump-1.out "(?n)^var _sd_not_equiv struct \{ d float\[0-9\]*; \}$" } } */
+/* { dg-final { scan-file godump-1.out "(?n)^var _sn struct \{ s struct \{ ca \\\[2\\+1\\\]uint\[0-9\]*; \}; i uint\[0-9\]*; \}$" } } */
+/* { dg-final { scan-file godump-1.out "(?n)^var _sn_anon struct \{ Godump_0 struct \{ a uint\[0-9\]*; s uint\[0-9\]*; \}; b uint\[0-9\]*; \}$" } } */
+/* { dg-final { scan-file godump-1.out "(?n)^var _sbf_anon_pad1 struct \{ c uint\[0-9\]*; \}$" } } */
+/* { dg-final { scan-file godump-1.out "(?n)^var _sbf_anon_pad2 struct \{ Godump_0_pad \\\[1\\\]byte; c uint\[0-9\]*; \}$" } } */
+/* { dg-final { scan-file godump-1.out "(?n)^var _sbf_anon_pad3 struct \{ Godump_0_pad \\\[1\\\]byte; c uint\[0-9\]*; \}$" } } */
+/* { dg-final { scan-file godump-1.out "(?n)^var _sbf_anon_pad4 struct \{ Godump_0 uint\[0-9\]*; c uint\[0-9\]*; \}$" } } */
+/* { dg-final { scan-file godump-1.out "(?n)^var _sbf_anon_pad5 struct \{ c uint\[0-9\]*; \}$" } } */
+/* { dg-final { scan-file godump-1.out "(?n)^var _sbf_anon_pad6 struct \{ Godump_0_pad \\\[1\\\]byte; c uint\[0-9\]*; \}$" } } */
+/* { dg-final { scan-file godump-1.out "(?n)^var _sbf_anon_pad7 struct \{ Godump_0_pad \\\[8\\\]byte; c uint\[0-9\]*; \}$" } } */
+/* { dg-final { scan-file godump-1.out "(?n)^var _sbf_anon_pad8 struct \{ Godump_0 uint\[0-9\]*; c uint\[0-9\]*; \}$" } } */
+/* { dg-final { scan-file godump-1.out "(?n)^var _sbf_pad8_1 struct \{ Godump_0_pad \\\[1\\\]byte; c uint\[0-9\]*; \}$" } } */
+/* { dg-final { scan-file godump-1.out "(?n)^var _sbf_pad8_2 struct \{ Godump_0_pad \\\[1\\\]byte; c uint\[0-9\]*; \}$" } } */
+/* { dg-final { scan-file godump-1.out "(?n)^var _sbf_pad8_3 struct \{ bf uint\[0-9\]*; c uint\[0-9\]*; \}$" } } */
+/* { dg-final { scan-file godump-1.out "(?n)^var _sbf_pad16_1 struct \{ Godump_0_pad \\\[1\\\]byte; c uint\[0-9\]*; Godump_1_align \\\[0\\\]int\[0-9\]*; \}$" } } */
+/* { dg-final { scan-file godump-1.out "(?n)^var _sbf_pad16_2 struct \{ Godump_0_pad \\\[2\\\]byte; c uint\[0-9\]*; Godump_1_align \\\[0\\\]int\[0-9\]*; \}$" } } */
+/* { dg-final { scan-file godump-1.out "(?n)^var _sbf_pad16_3 struct \{ bf uint\[0-9\]*; c uint\[0-9\]*; \}$" } } */
+/* { dg-final { scan-file godump-1.out "(?n)^var _sbf_pad32_1 struct \{ Godump_0_pad \\\[1\\\]byte; c uint\[0-9\]*; Godump_1_align \\\[0\\\]int\[0-9\]*; \}$" } } */
+/* { dg-final { scan-file godump-1.out "(?n)^var _sbf_pad32_2 struct \{ Godump_0_pad \\\[4\\\]byte; c uint\[0-9\]*; Godump_1_align \\\[0\\\]int\[0-9\]*; \}$" } } */
+/* { dg-final { scan-file godump-1.out "(?n)^var _sbf_pad32_3 struct \{ bf uint\[0-9\]*; c uint\[0-9\]*; \}$" } } */
+/* { dg-final { scan-file godump-1.out "(?n)^var _sbf_pad64_1 struct \{ Godump_0_pad \\\[1\\\]byte; c uint\[0-9\]*; Godump_1_align \\\[0\\\]int\[0-9\]*; \}$" } } */
+/* { dg-final { scan-file godump-1.out "(?n)^var _sbf_pad64_2 struct \{ Godump_0_pad \\\[8\\\]byte; c uint\[0-9\]*; Godump_1_align \\\[0\\\]int\[0-9\]*; \}$" } } */
+/* { dg-final { scan-file godump-1.out "(?n)^var _sbf_pad64_3 struct \{ bf uint\[0-9\]*; c uint\[0-9\]*; \}$" } } */
+/* { dg-final { scan-file godump-1.out "(?n)^var _sbf_1b struct \{ Godump_0_pad \\\[1\\\]byte; \}$" } } */
+/* { dg-final { scan-file godump-1.out "(?n)^var _sbf_8b struct \{ Godump_0_pad \\\[1\\\]byte; \}$" } } */
+/* { dg-final { scan-file godump-1.out "(?n)^var _sbf_9b struct \{ Godump_0_pad \\\[2\\\]byte; \}$" } } */
+/* { dg-final { scan-file godump-1.out "(?n)^var _sbf_18b struct \{ Godump_0_pad \\\[3\\\]byte; \}$" } } */
+/* { dg-final { scan-file godump-1.out "(?n)^var _sbf_gaps struct \{ bf1 uint\[0-9\]*; c uint\[0-9\]*; bf2 uint\[0-9\]*; Godump_0_pad \\\[2\\\]byte; s uint\[0-9\]*; Godump_1_align \\\[0\\\]int\[0-9\]*; \}$" } } */
+/* { dg-final { scan-file godump-1.out "(?n)^var _ue struct \{ Godump_0 \\\[0\\\]byte; \}$" } } */
+/* { dg-final { scan-file godump-1.out "(?n)^var _u1 struct \{ c \\\[8\\\]byte; \}$" } } */
+/* { dg-final { scan-file godump-1.out "(?n)^var _u2 struct \{ l \\\[8\\\]byte; \}$" } } */
+/* { dg-final { scan-file godump-1.out "(?n)^var _su_anon struct \{ Godump_0 struct \{ c \\\[8\\\]byte; \}; \}$" } } */
+/* { dg-final { scan-file godump-1.out "(?n)^var _u_size struct \{ bf \\\[8\\\]byte; \}$" } } */
+/* { dg-final { scan-file godump-1.out "(?n)^var _u2_size struct \{ Godump_0 \\\[5\\\]byte; \}$" } } */
+/* { dg-final { scan-file godump-1.out "(?n)^func _func1 \[(\]uint\[0-9\]*\[)\] uint\[0-9\]* __asm__\[(\]\"func1\"\[)\]$" } } */
+/* { dg-final { scan-file godump-1.out "(?n)^const _E11 = 0$" } } */
+/* { dg-final { scan-file godump-1.out "(?n)^const _E21 = 0$" } } */
+/* { dg-final { scan-file godump-1.out "(?n)^const _E22 = 1$" } } */
+/* { dg-final { scan-file godump-1.out "(?n)^const _EN1 = 3$" } } */
+/* { dg-final { scan-file godump-1.out "(?n)^const _EN2 = 77$" } } */
+/* { dg-final { scan-file godump-1.out "(?n)^const _EN3 = -1$" } } */
+/* { dg-final { scan-file godump-1.out "(?n)^const _EN4 = 0$" } } */
+/* { dg-final { scan-file godump-1.out "(?n)^const _ET1 = 0$" } } */
+/* { dg-final { scan-file godump-1.out "(?n)^const _ET2 = 1$" } } */
+/* { dg-final { scan-file godump-1.out "(?n)^const _ETV1 = 0$" } } */
+/* { dg-final { scan-file godump-1.out "(?n)^const _ETV2 = 1$" } } */
+/* { dg-final { scan-file godump-1.out "(?n)^const _EV11 = 0$" } } */
+/* { dg-final { scan-file godump-1.out "(?n)^const _EV21 = 0$" } } */
+/* { dg-final { scan-file godump-1.out "(?n)^const _EV22 = 1$" } } */
diff --git a/gcc/testsuite/gcc.misc-tests/godump.exp b/gcc/testsuite/gcc.misc-tests/godump.exp
new file mode 100644
index 0000000..96812c4
--- /dev/null
+++ b/gcc/testsuite/gcc.misc-tests/godump.exp
@@ -0,0 +1,36 @@
+# Copyright (C) 2014 Free Software Foundation, Inc.
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with GCC; see the file COPYING3.  If not see
+# <http://www.gnu.org/licenses/>.
+
+# GCC testsuite that uses the `dg.exp' driver.
+
+# Load support procs.
+load_lib gcc-dg.exp
+
+# If a testcase doesn't have special options, use these.
+global DEFAULT_CFLAGS
+if ![info exists DEFAULT_CFLAGS] then {
+    set DEFAULT_CFLAGS " -ansi -pedantic-errors"
+}
+
+# Initialize `dg'.
+dg-init
+
+# Main loop.
+dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/godump-*.c]] \
+	"" $DEFAULT_CFLAGS
+
+# All done.
+dg-finish
-- 
1.8.4.2


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]