diff --git a/gcc/testsuite/gcc.dg/debug/ctf/ctf-2.c b/gcc/testsuite/gcc.dg/debug/ctf/ctf-2.c
new file mode 100644
index 0000000..891f20e
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/debug/ctf/ctf-2.c
@@ -0,0 +1,10 @@
+/* A LEVEL of 0 with -gt turns off CTF debug info generation.  */
+
+/* { dg-do compile } */
+/* { dg-options "-gt0 -dA" } */
+
+/* { dg-final { scan-assembler-times "0xdff2.*CTF preamble magic number" 0} } */
+/* { dg-final { scan-assembler-times "0x4.*CTF preamble version" 0 } } */
+/* { dg-final { scan-assembler-times "0.*CTF preamble flags" 0 } } */
+
+const char * _CONTEXT_NAME = "foobar";
diff --git a/gcc/testsuite/gcc.dg/debug/ctf/ctf-anonymous-struct-1.c b/gcc/testsuite/gcc.dg/debug/ctf/ctf-anonymous-struct-1.c
new file mode 100644
index 0000000..0973b2b
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/debug/ctf/ctf-anonymous-struct-1.c
@@ -0,0 +1,23 @@
+/* Test compilation and CTF generation of anonymous structs.  An anonymous
+   struct type is encoded as no-name CTF struct type.
+
+   For this testcase, a single CTF anonymous struct is expected.
+   struct {} : ctt_name = 0 (point to offset 0 in the CTF string table to
+			    denote empty string)
+   
+   Two CTF struct records should be generated in total.
+   struct a : ctt_info = 0x1a000002 (2 fields)
+   struct {} : ctt_info = 0x1a000001 (1 field)  */
+
+/* { dg-do compile )  */
+/* { dg-options "-O0 -gt -dA" } */
+
+/* { dg-final { scan-assembler-times "\[\t \]0\[\t \]+\[^\n\]*ctt_name" 1 } } */
+/* { dg-final { scan-assembler-times "0x1a000002\[\t \]+\[^\n\]*ctt_info" 1 } } */
+/* { dg-final { scan-assembler-times "0x1a000001\[\t \]+\[^\n\]*ctt_info" 1 } } */
+
+struct a
+{
+  struct { int b1; } a1;
+  int a2;
+} my_a;
diff --git a/gcc/testsuite/gcc.dg/debug/ctf/ctf-anonymous-union-1.c b/gcc/testsuite/gcc.dg/debug/ctf/ctf-anonymous-union-1.c
new file mode 100644
index 0000000..71b491a
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/debug/ctf/ctf-anonymous-union-1.c
@@ -0,0 +1,26 @@
+/* Test compilation and CTF generation of anonymous union.  An anonymous union
+   is encoded as no-name CTF union type.
+
+   For this testcase, a single CTF anonymous union is expected.
+   struct {} : ctt_name = 0 (point to offset 0 in the CTF string table to
+			    denote empty string)
+   
+   Two CTF struct records should be generated in total.
+   struct anon_union : ctt_info = 0x1a000001 (1 field)
+   union {} : ctt_info = 0x1e000002 (2 fields)  */
+
+/* { dg-do compile )  */
+/* { dg-options "-O0 -gt -dA" } */
+
+/* { dg-final { scan-assembler-times "\[\t \]0\[\t \]+\[^\n\]*ctt_name" 1 } } */
+/* { dg-final { scan-assembler-times "0x1a000001\[\t \]+\[^\n\]*ctt_info" 1 } } */
+/* { dg-final { scan-assembler-times "0x1e000002\[\t \]+\[^\n\]*ctt_info" 1 } } */
+
+struct anon_union
+{
+  union
+    {
+      char name;
+      int value;
+    };
+} my_anon_u;
diff --git a/gcc/testsuite/gcc.dg/debug/ctf/ctf-array-1.c b/gcc/testsuite/gcc.dg/debug/ctf/ctf-array-1.c
new file mode 100644
index 0000000..cca8c42
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/debug/ctf/ctf-array-1.c
@@ -0,0 +1,31 @@
+/* CTF generation for array type.
+
+   Unsized arrays are encoded with a 0 for the number of elements.
+
+   In this testcase, 5 distinct CTF records for arrays are expected
+   b1 : cta_nelems = 2
+   c1 : cta_nelems = 3
+   a1 : cta_nelems = 2, 5
+   buf1 : cta_nelems = 0.  */
+
+/* { dg-do compile )  */
+/* { dg-options "-O0 -gt -dA" } */
+
+/* { dg-final { scan-assembler-times "0x12000000\[\t \]+\[^\n\]*ctt_info" 5 } } */
+
+/* { dg-final { scan-assembler-times "\[\t \]0x2\[\t \]+\[^\n\]*cta_nelems" 2 } } */
+/* { dg-final { scan-assembler-times "\[\t \]0x3\[\t \]+\[^\n\]*cta_nelems" 1 } } */
+/* { dg-final { scan-assembler-times "\[\t \]0x5\[\t \]+\[^\n\]*cta_nelems" 1 } } */
+/* { dg-final { scan-assembler-times "\[\t \]0\[\t \]+\[^\n\]*cta_nelems" 1 } } */
+
+int b1[2] = {0,1};
+int c1[5] = {0,1,2,3,4};
+int a1[2][3] = { {3,4,5}, {2,3,4} };
+
+/* Variable length struct using arrays.  */
+struct my_array
+{
+  int flags;
+  int length;
+  int buf[];
+} my_array_obj;
diff --git a/gcc/testsuite/gcc.dg/debug/ctf/ctf-array-2.c b/gcc/testsuite/gcc.dg/debug/ctf/ctf-array-2.c
new file mode 100644
index 0000000..744f15e
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/debug/ctf/ctf-array-2.c
@@ -0,0 +1,39 @@
+/* CTF generation for unsized arrays.
+
+   Unsized arrays are encoded with a 0 for the number of elements.  The type
+   of array index is the INT type.
+
+   TBD_CTF_FORMAT_OPEN_ISSUES (1) - 
+   This testcase makes a note of the case of a probable misrepresentation.
+   See Note 1 and Note 2 below.
+
+   In the CTF section, these types are encoded as :
+
+     Variables:
+      _CTF_NEWSTR ->  7: const char [0] (size 0x0)
+      _CTF_SECTION ->  6: const char [5] (size 0x5)
+      b1 ->  2: int [0] (size 0x0)
+      b2 ->  3: int [0] (size 0x0)
+
+    Note 1 : There is misrepresentation in that b1 and b2 are specified
+    differently by the user.
+    Note 2 : It is arguable though whether the representation for
+    _CTF_NEWSTR is incorrect.  */
+
+/* { dg-do compile )  */
+/* { dg-options "-O0 -gt -dA" } */
+
+/* { dg-final { scan-assembler-times "0x12000000\[\t \]+\[^\n\]*ctt_info" 4 } } */
+
+/* { dg-final { scan-assembler-times "\[\t \]0x1\[\t \]+\[^\n\]*cta_index" 4 } } */
+/* { dg-final { scan-assembler-times "\[\t \]0\[\t \]+\[^\n\]*cta_nelems" 3 } } */
+/* { dg-final { scan-assembler-times "\[\t \]0x5\[\t \]+\[^\n\]*cta_nelems" 1 } } */
+
+static int b1[] = {};
+
+int b2[0];
+
+const char _CTF_SECTION[] = ".ctf";
+
+extern const char _CTF_NEWSTR[];
+const char _CTF_NEWSTR[] = "ctfinfo"; 
diff --git a/gcc/testsuite/gcc.dg/debug/ctf/ctf-bitfields-1.c b/gcc/testsuite/gcc.dg/debug/ctf/ctf-bitfields-1.c
new file mode 100644
index 0000000..5f26629
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/debug/ctf/ctf-bitfields-1.c
@@ -0,0 +1,30 @@
+/* CTF generation for bitfields.
+   
+   In this testcase, two slices are expected - one for enum and the other for
+   int.  CTF slices are unnamed records.  */
+   
+/* { dg-do compile )  */
+/* { dg-options "-O0 -gt -dA" } */
+
+/* { dg-final { scan-assembler-times "\[\t \]0x2\[\t \]+\[^\n\]*cts_bits" 1 } } */
+/* { dg-final { scan-assembler-times "\[\t \]0x3\[\t \]+\[^\n\]*cts_bits" 1 } } */
+/* { dg-final { scan-assembler-times "\[\t \]0\[\t \]+\[^\n\]*ctt_name" 2 } } */
+
+enum color
+{
+  RED,
+  GREEN,
+  BLUE,
+  YELLOW,
+  ORANGE,
+  BLACK
+};
+
+struct quickcolor
+{
+  enum color col:3;
+  int brushid:2;
+  int strokes;
+};
+
+struct quickcolor qc;
diff --git a/gcc/testsuite/gcc.dg/debug/ctf/ctf-bitfields-2.c b/gcc/testsuite/gcc.dg/debug/ctf/ctf-bitfields-2.c
new file mode 100644
index 0000000..ed85cf3
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/debug/ctf/ctf-bitfields-2.c
@@ -0,0 +1,39 @@
+/* The bitfield type (int) may be shared, but slices are not de-duplicated.
+
+   In this testcase, it is expected to see a total of 6 CTF slices and 2 CTF
+   integer types for the bitfields - unsigned long long and signed long long.
+   
+   cts_offset is the offset of the bitfield into a machine word.
+   TBD - hardcoding cts_offset checks into the testcase will cause it to break
+   across targets with different BIT_PER_WORD.  Is there a way to add
+   cts_offset related checks in the testcase?  */
+
+/* { dg-do compile )  */
+/* { dg-options "-O0 -gt -dA" } */
+
+/* { dg-final { scan-assembler-times "\[\t \]0x6\[\t \]+\[^\n\]*cts_type" 3 } } */
+/* { dg-final { scan-assembler-times "\[\t \]0x2\[\t \]+\[^\n\]*cts_type" 3 } } */
+
+/* { dg-final { scan-assembler-times "\[\t \]0xf\[\t \]+\[^\n\]*cts_bits" 2 } } */
+/* { dg-final { scan-assembler-times "\[\t \]0x21\[\t \]+\[^\n\]*cts_bits" 2 } } */
+/* { dg-final { scan-assembler-times "\[\t \]0x10\[\t \]+\[^\n\]*cts_bits" 2 } } */
+
+/* { dg-final { scan-assembler-times "ascii \"long long unsigned int.0\"\[\t \]+\[^\n\]*ctf_string" 1 } } */
+/* { dg-final { scan-assembler-times "ascii \"long long int.0\"\[\t \]+\[^\n\]*ctf_string" 1 } } */
+
+struct fields
+{
+  unsigned long long u1 : 15;
+  unsigned long long u2 : 33;
+  unsigned long long u3 : 16;
+  signed long long   s1 : 15;
+  signed long long   s2 : 33;
+  signed long long   s3 : 16;
+} flags;
+
+int i = 33;
+
+int main ()
+{
+    return flags.u1 + i;
+}
diff --git a/gcc/testsuite/gcc.dg/debug/ctf/ctf-complex-1.c b/gcc/testsuite/gcc.dg/debug/ctf/ctf-complex-1.c
new file mode 100644
index 0000000..3d02b87
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/debug/ctf/ctf-complex-1.c
@@ -0,0 +1,22 @@
+/* Tests for CTF complex base types.
+
+   CTF does not have representation for COMPLEX integer types.
+   
+   This testcase has a mix of C constructs containing COMPLEX_TYPE.  */
+
+/* { dg-do compile )  */
+/* { dg-options "-O0 -gt -dA" } */
+
+/* { dg-final { scan-assembler-times "\[\t \]0xa000000\[\t \]+\[^\n\]*ctt_info" 3 } } */
+
+/* { dg-final { scan-assembler-times "ascii \"complex double.0\"\[\t \]+\[^\n\]*ctf_string" 1 } } */
+/* { dg-final { scan-assembler-times "ascii \"complex long double.0\"\[\t \]+\[^\n\]*ctf_string" 1 } } */
+/* { dg-final { scan-assembler-times "ascii \"complex float.0\"\[\t \]+\[^\n\]*ctf_string" 1 } } */
+
+#include <complex.h>
+
+double complex z1 = I * I;
+
+const long double complex z2 = I * I;
+
+float complex z4 = 1+2.11*I;
diff --git a/gcc/testsuite/gcc.dg/debug/ctf/ctf-cvr-quals-1.c b/gcc/testsuite/gcc.dg/debug/ctf/ctf-cvr-quals-1.c
new file mode 100644
index 0000000..318a171
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/debug/ctf/ctf-cvr-quals-1.c
@@ -0,0 +1,44 @@
+/* Test compilation of stubs with various qualifiers - const, restrict and
+   volatile.
+
+   Testcase includes a std header to allow testing of shared types across
+   files.  Only one CTF record for int is expected.
+   
+   CTF records for CVR qualifiers are no-name records.  In this testcase, there
+   are 7 qualifiers across constructs.  2 more no-name CTF records correspond to
+   CTF pointer records.
+
+    TYPEID: name string (size) -> ref TYPEID : ref name string (size) -> ...
+
+    b: volatile int (size 4) -> 5: int (size 4)
+    c: const volatile int (size 4) -> b: volatile int (size 4) -> 5: int (size 4)
+    e: int *restrict (size 8) -> d: int * (size 8) -> 5: int (size 4)
+    f: const int (size 4) -> 5: int (size 4)
+    10: const int * (size 8) -> f: const int (size 4) -> 5: int (size 4)
+    12: int *const (size 8) -> d: int * (size 8) -> 5: int (size 4)
+    14: const int *restrict (size 8) -> 10: const int * (size 8) -> f: const int (size 4) -> 5: int (size 4)
+    */
+
+/* { dg-do compile )  */
+/* { dg-options "-O0 -gt -dA" } */
+
+/* { dg-final { scan-assembler-times "ascii \"int.0\"\[\t \]+\[^\n\]*ctf_string" 1 } } */
+/* { dg-final { scan-assembler-times "\[\t \]0\[\t \]+\[^\n\]*ctt_name" 9 } } */
+/* { dg-final { scan-assembler-times "\[\t \]0xe000000\[\t \]+\[^\n\]*ctt_info" 2 } } */
+
+#include "stddef.h"
+
+const volatile int a = 5;
+int *restrict b;
+
+const int * i;
+int const * j;
+
+typedef int * INTP;
+const INTP int_p;
+
+void foo (size_t n, int *restrict p, const int *restrict q)
+{
+  while (n-- > 0)
+    *p++ = *q++;
+}
diff --git a/gcc/testsuite/gcc.dg/debug/ctf/ctf-cvr-quals-2.c b/gcc/testsuite/gcc.dg/debug/ctf/ctf-cvr-quals-2.c
new file mode 100644
index 0000000..8ce6676
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/debug/ctf/ctf-cvr-quals-2.c
@@ -0,0 +1,30 @@
+/* Test compilation of stubs with various expressions involving const
+   qualifier.
+   
+   In this testcase, a single CTF record for const int is expected. A total of
+   two const qualifier CTF records are expected (const int and const struct
+   s1).  */
+
+/* { dg-do compile )  */
+/* { dg-options "-O0 -gt -dA" } */
+
+/* { dg-final { scan-assembler-times "ascii \"int.0\"\[\t \]+\[^\n\]*ctf_string" 1 } } */
+/* { dg-final { scan-assembler-times "\[\t \]0x32000000\[\t \]+\[^\n\]*ctt_info" 2 } } */
+
+struct mystruct
+{
+  struct
+    {
+      int a; 
+      const int b;
+    } s1;
+  char * name;
+} my_a;
+
+struct s1
+{
+  int i;
+  const int ci;
+} s;
+
+const struct s1 cs;
diff --git a/gcc/testsuite/gcc.dg/debug/ctf/ctf-cvr-quals-3.c b/gcc/testsuite/gcc.dg/debug/ctf/ctf-cvr-quals-3.c
new file mode 100644
index 0000000..6ec17a6
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/debug/ctf/ctf-cvr-quals-3.c
@@ -0,0 +1,41 @@
+/* Test compilation of stubs with various expressions involving const and
+   volatile qualifiers.
+   
+   In this testcase, it is expected to have const and volatile CTF records,
+   some of which are shared or referenced (shown by '->' below) :
+
+   Types:
+    1: unsigned char (size 1)
+    2: volatile unsigned char (size 1) -> 1: unsigned char (size 1)
+    3: const volatile unsigned char (size 1) -> 2: volatile unsigned char (size 1) -> 1: unsigned char (size 1)
+    4: const volatile unsigned char * (size 8) -> 3: const volatile unsigned char (size 1) -> 2: volatile unsigned char (size 1) -> 1: unsigned char (size 1) [POINTER_TYPE]
+    5: int (size 4)
+    6: float (size 4)
+    7: volatile float (size 4) -> 6: float (size 4)
+    8: volatile float [2] (size 8) [ARRAY_TYPE]
+    9: char (size 1)
+    a: volatile char (size 1) -> 9: char (size 1)
+    b: const volatile char (size 1) -> a: volatile char (size 1) -> 9: char (size 1)
+    c: const volatile char [2] (size 2) [ARRAY_TYPE]
+
+    Types 2, 3, 7, a, and b are CTF types of kind CTF_K_CONST or CTF_K_VOLATILE.  */
+
+/* { dg-do compile )  */
+/* { dg-options "-O0 -gt -dA" } */
+
+/* { dg-final { scan-assembler-times "ascii \"int.0\"\[\t \]+\[^\n\]*ctf_string" 1 } } */
+/* { dg-final { scan-assembler-times "\[\t \]0x2e000000\[\t \]+\[^\n\]*ctt_info" 3 } } */
+/* { dg-final { scan-assembler-times "\[\t \]0x32000000\[\t \]+\[^\n\]*ctt_info" 2 } } */
+/* Two arrays.  */
+/* { dg-final { scan-assembler-times "\[\t \]0x12000000\[\t \]+\[^\n\]*ctt_info" 2 } } */
+
+
+const volatile unsigned char  vicar = 11;
+
+const volatile unsigned char * vicarage = &vicar;
+
+volatile float vilify[2];
+
+const volatile char victor = 'Y';
+
+const volatile char vindictive[2];
diff --git a/gcc/testsuite/gcc.dg/debug/ctf/ctf-enum-1.c b/gcc/testsuite/gcc.dg/debug/ctf/ctf-enum-1.c
new file mode 100644
index 0000000..d91a419
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/debug/ctf/ctf-enum-1.c
@@ -0,0 +1,21 @@
+/* CTF generation for enums.  */
+
+/* { dg-do compile )  */
+/* { dg-options "-O0 -gt -dA" } */
+
+/* { dg-final { scan-assembler-times "ascii \"RED.0\"\[\t \]+\[^\n\]*ctf_string" 1 } } */
+/* { dg-final { scan-assembler-times "ascii \"GREEN.0\"\[\t \]+\[^\n\]*ctf_string" 1 } } */
+/* { dg-final { scan-assembler-times "ascii \"BLUE.0\"\[\t \]+\[^\n\]*ctf_string" 1 } } */
+/* { dg-final { scan-assembler-times "ascii \"YELLOW.0\"\[\t \]+\[^\n\]*ctf_string" 1 } } */
+/* { dg-final { scan-assembler-times "cte_value" 4} } */
+
+
+enum foo_color
+{
+  RED,
+  GREEN,
+  BLUE,
+  YELLOW
+};
+
+enum foo_color my_color;
diff --git a/gcc/testsuite/gcc.dg/debug/ctf/ctf-enum-2.c b/gcc/testsuite/gcc.dg/debug/ctf/ctf-enum-2.c
new file mode 100644
index 0000000..ef87691
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/debug/ctf/ctf-enum-2.c
@@ -0,0 +1,26 @@
+/* CTF generation for enums.
+
+   CTF represents enum values with an int32_t.  The compiler skips adding these
+   enum values into the CTF for the enum type.  This will be fixed soon in the
+   format.  TBD_CTF_REPRESENTATION_LIMIT.
+   
+   In this testcase, CTF for enumerator GFS_MONOTONIC will not be generated.  */
+
+/* { dg-do compile )  */
+/* { dg-options "-O0 -gt -dA" } */
+
+/* { dg-final { scan-assembler-times "ascii \"GFS_MONOTONIC.0\"\[\t \]+\[^\n\]*ctf_string" 0 } } */
+/* { dg-final { scan-assembler-times "ascii \"GFS_RUNTIME.0\"\[\t \]+\[^\n\]*ctf_string" 1 } } */
+/* { dg-final { scan-assembler-times "ascii \"GFS_STATIC.0\"\[\t \]+\[^\n\]*ctf_string" 1 } } */
+/* { dg-final { scan-assembler-times "cte_value" 2} } */
+
+
+enum gomp_schedule_type
+{
+  GFS_RUNTIME,
+  GFS_STATIC,
+  GFS_MONOTONIC = 0x80000000U
+};
+
+enum gomp_schedule_type gsch_type;
+
diff --git a/gcc/testsuite/gcc.dg/debug/ctf/ctf-float-1.c b/gcc/testsuite/gcc.dg/debug/ctf/ctf-float-1.c
new file mode 100644
index 0000000..ae2dfc2
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/debug/ctf/ctf-float-1.c
@@ -0,0 +1,16 @@
+/* Tests for CTF float base types.
+   - Verify that there is a single record for the base types.  */
+
+/* { dg-do compile )  */
+/* { dg-options "-O0 -gt -dA" } */
+/* { dg-final { scan-assembler-times "ascii \"float.0\"\[\t \]+\[^\n\]*ctf_string" 1 } } */
+/* { dg-final { scan-assembler-times "ascii \"double.0\"\[\t \]+\[^\n\]*ctf_string" 1 } } */
+/* { dg-final { scan-assembler-times "ascii \"long double.0\"\[\t \]+\[^\n\]*ctf_string" 1 } } */
+
+float a;
+float b = 33;
+
+double c = 44;
+double d = 45;
+
+long double e;
diff --git a/gcc/testsuite/gcc.dg/debug/ctf/ctf-forward-1.c b/gcc/testsuite/gcc.dg/debug/ctf/ctf-forward-1.c
new file mode 100644
index 0000000..8254d3e
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/debug/ctf/ctf-forward-1.c
@@ -0,0 +1,36 @@
+/* CTF forward type is generated for forward declarations of types in C.
+   
+   Check that the ctf-kind of CTF_K_FOWARD type is CTF_K_STRUCT or CTF_K_UNION.
+   For forward types, the compiler encodes the CTF kind in the ctt_type field.
+   CTF_K_FORWARD is used as the CTF type as usual in the ctt_info.  */
+
+/* Note - A value of 6 in "ctt_size or ctt_type" appears twice in this
+   testcase. This might be misconstrued as  2 CTK_K_FORWARD records of struct
+   type.  The second assembler tag is due to a ref type in a CVR CTF record.
+   TBD - perhaps a more robust string pattern is needed.  */
+
+/* { dg-do compile )  */
+/* { dg-options "-O0 -gt -dA" } */
+
+/* { dg-final { scan-assembler-times "\[\t \]0x26000000\[\t \]+\[^\n\]*ctt_info" 2 } } */
+/* { dg-final { scan-assembler-times "\[\t \]0x6\[\t \]+\[^\n\]*ctt_size or ctt_type" 2 } } */
+/* { dg-final { scan-assembler-times "\[\t \]0x7\[\t \]+\[^\n\]*ctt_size or ctt_type" 1 } } */
+
+typedef struct __locale_struct
+{
+  struct __locale_data *__locales[13]; /* forward struct type.  */
+
+  const int *__ctype_toupper;
+  const char *__names[13];
+} *__locale_t;
+
+typedef __locale_t locale_t;
+
+typedef struct __inter_struct
+{
+  union __inter_data * __inters[13]; /* forward union type.  */
+
+  const int * __ctype_kind;
+} * __inter_t;
+
+typedef __inter_t inter_t;
diff --git a/gcc/testsuite/gcc.dg/debug/ctf/ctf-forward-2.c b/gcc/testsuite/gcc.dg/debug/ctf/ctf-forward-2.c
new file mode 100644
index 0000000..33080f2
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/debug/ctf/ctf-forward-2.c
@@ -0,0 +1,16 @@
+/* CTF forward type is generated for forward declarations of enum types in C.
+   
+   Check that the ctf-kind of CTF_K_FOWARD type is CTF_K_ENUM.
+   For forward types, the compiler encodes the CTF kind in the ctt_type field.
+   CTF_K_FORWARD is used as the CTF type as usual in the ctt_info.  */
+
+/* { dg-do compile )  */
+/* { dg-options "-O0 -gt -dA" } */
+
+/* { dg-final { scan-assembler-times "\[\t \]0x26000000\[\t \]+\[^\n\]*ctt_info" 1 } } */
+/* { dg-final { scan-assembler-times "\[\t \]0x8\[\t \]+\[^\n\]*ctt_size or ctt_type" 1 } } */
+/* { dg-final { scan-assembler-times "ascii \"vibgyor.0\"\[\t \]+\[^\n\]*ctf_string" 1 } } */
+
+enum vibgyor;
+
+char * (*get_color_name) (enum vibgyor);
diff --git a/gcc/testsuite/gcc.dg/debug/ctf/ctf-func-index-1.c b/gcc/testsuite/gcc.dg/debug/ctf/ctf-func-index-1.c
new file mode 100644
index 0000000..4215615
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/debug/ctf/ctf-func-index-1.c
@@ -0,0 +1,25 @@
+/* CTF function index sub-section.
+
+   A function index sub-section in the CTF section contains the offset to the
+   string name of the global function symbols.  The number of entries in the
+   func info section and the func index section are always the same.
+
+   In this testcase, 2 records in the function index section are expected.  */
+
+/* { dg-do compile )  */
+/* { dg-options "-O0 -gt -dA" } */
+
+/* { dg-final { scan-assembler-times "funcinfo_name" 2 } } */
+/* { dg-final { scan-assembler-times "funcinfo_func_type" 2 } } */
+/* { dg-final { scan-assembler-times "ascii \"bar.0\"\[\t \]+\[^\n\]*ctf_string" 1 } } */
+/* { dg-final { scan-assembler-times "ascii \"foo.0\"\[\t \]+\[^\n\]*ctf_string" 1 } } */
+
+int foo (void)
+{
+  return 0;
+}
+
+int bar (int a)
+{
+  return 33 + a;
+}
diff --git a/gcc/testsuite/gcc.dg/debug/ctf/ctf-function-pointers-1.c b/gcc/testsuite/gcc.dg/debug/ctf/ctf-function-pointers-1.c
new file mode 100644
index 0000000..e324445
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/debug/ctf/ctf-function-pointers-1.c
@@ -0,0 +1,24 @@
+/* CTF generation of function pointers.  */
+
+/* { dg-do compile )  */
+/* { dg-options "-O0 -gt -dA" } */
+/* { dg-final { scan-assembler-times "\[\t \]0x16000001\[\t \]+\[^\n\]*ctt_info" 1 } } */
+/* { dg-final { scan-assembler-times "\[\t \]0x16000002\[\t \]+\[^\n\]*ctt_info" 1 } } */
+/* { dg-final { scan-assembler-times "\[\t \]0x16000003\[\t \]+\[^\n\]*ctt_info" 1 } } */
+/* { dg-final { scan-assembler-times "ascii \"__foo_fn.0\"\[\t \]+\[^\n\]*ctf_string" 1 } } */
+/* { dg-final { scan-assembler-times "ascii \"destroy.0\"\[\t \]+\[^\n\]*ctf_string" 1 } } */
+/* { dg-final { scan-assembler-times "ascii \"func.0\"\[\t \]+\[^\n\]*ctf_string" 1 } } */
+
+int (*func) (int *, char);
+
+typedef int __foo_fn (void *__cookie, char *__buf, int __nbytes);
+
+typedef struct object
+{
+   int myint;
+   char mychar;
+   void (*destroy)(struct object *);
+} object_t;
+
+object_t myobj;
+__foo_fn fooit;
diff --git a/gcc/testsuite/gcc.dg/debug/ctf/ctf-functions-1.c b/gcc/testsuite/gcc.dg/debug/ctf/ctf-functions-1.c
new file mode 100644
index 0000000..20bade1
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/debug/ctf/ctf-functions-1.c
@@ -0,0 +1,34 @@
+/* CTF generation for functions with varargs or otherwise.
+
+   In this testcase, it is expected to see one CTF_K_FUNCTION record with two
+   function arguments.  The second function argument with a value of 0
+   corresponds to the ellipsis.
+
+   Example CTF section excerpt on x86_64 :
+
+    .long   0x5     # ctt_name		    (name = format)
+    .long   0x16000002      # ctt_info	    (CTF_K_FUNCTION with 2 arguments)
+    .long   0x2     # ctt_size or ctt_type  (return typeID)
+    .long   0x2     # dtu_argv		    (TypeID of the First argument)
+    .long   0       # dtu_argv		    (TypeID of the second argument)
+    .ascii "\0"     # ctf_string
+    .ascii "int\0"  # ctf_string
+    .ascii "format\0"       # ctf_string
+
+    */
+
+/* { dg-do compile )  */
+/* { dg-options "-O0 -gt -dA" } */
+
+/* { dg-final { scan-assembler-times "\[\t \]0x16000002\[\t \]+\[^\n\]*ctt_info" 1 } } */
+/* { dg-final { scan-assembler-times "dtu_argv" 2 } } */
+/* { dg-final { scan-assembler-times "\[\t \]0\[\t \]+\[^\n\]*dtu_argv" 1 } } */
+
+int foo (void);
+
+int bar (int);
+
+int * format (int * fmt, ...)
+{
+  return fmt;
+}
diff --git a/gcc/testsuite/gcc.dg/debug/ctf/ctf-int-1.c b/gcc/testsuite/gcc.dg/debug/ctf/ctf-int-1.c
new file mode 100644
index 0000000..88f2a3a
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/debug/ctf/ctf-int-1.c
@@ -0,0 +1,17 @@
+/* Tests for CTF integer base types.
+   - Verify that there is a single record for the base types.  */
+
+/* { dg-do compile )  */
+/* { dg-options "-O0 -gt -dA" } */
+/* { dg-final { scan-assembler-times "ascii \"int.0\"\[\t \]+\[^\n\]*ctf_string" 1 } } */
+/* { dg-final { scan-assembler-times "ascii \"short int.0\"\[\t \]+\[^\n\]*ctf_string" 1 } } */
+/* { dg-final { scan-assembler-times "ascii \"long int.0\"\[\t \]+\[^\n\]*ctf_string" 1 } } */
+
+int a;
+int b = 33;
+
+short int c = 44;
+short int d = 45;
+
+long int e = 90;
+long int f;
diff --git a/gcc/testsuite/gcc.dg/debug/ctf/ctf-objt-index-1.c b/gcc/testsuite/gcc.dg/debug/ctf/ctf-objt-index-1.c
new file mode 100644
index 0000000..8d380d8
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/debug/ctf/ctf-objt-index-1.c
@@ -0,0 +1,29 @@
+/* CTF objext index sub-section.
+
+   An object index sub-section in the CTF section contains the offset to the
+   string name of the global object symbols.  The number of entries in the
+   obj info section and objt index section are always the same. 
+
+   In this testcase, 3 records in the object index section are expected.  */
+
+/* { dg-do compile )  */
+/* { dg-options "-O0 -gt -dA" } */
+
+/* { dg-final { scan-assembler-times "objtinfo_name" 3 } } */
+/* { dg-final { scan-assembler-times "objtinfo_var_type" 3 } } */
+/* { dg-final { scan-assembler-times "ascii \"a.0\"\[\t \]+\[^\n\]*ctf_string" 1 } } */
+/* { dg-final { scan-assembler-times "ascii \"a1.0\"\[\t \]+\[^\n\]*ctf_string" 1 } } */
+/* { dg-final { scan-assembler-times "ascii \"d_instance.0\"\[\t \]+\[^\n\]*ctf_string" 1 } } */
+
+static int b = 33;
+
+int a = 44;
+int a1[2] = {22, 33};
+
+struct d
+{
+  int d1;
+  int d2;
+};
+
+struct d d_instance;
diff --git a/gcc/testsuite/gcc.dg/debug/ctf/ctf-pointers-1.c b/gcc/testsuite/gcc.dg/debug/ctf/ctf-pointers-1.c
new file mode 100644
index 0000000..32da7bd
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/debug/ctf/ctf-pointers-1.c
@@ -0,0 +1,26 @@
+/* CTF generation for pointer types.
+
+   In this testcase, two CTF pointer type records are expected
+     - int *
+     - struct foo_struct *
+  */
+
+/* { dg-do compile )  */
+/* { dg-options "-O0 -gt -dA" } */
+
+/* { dg-final { scan-assembler-times "ascii \"foo_struct.0\"\[\t \]+\[^\n\]*ctf_string" 1 } } */
+/* { dg-final { scan-assembler-times "ascii \"int.0\"\[\t \]+\[^\n\]*ctf_string" 1 } } */
+/* { dg-final { scan-assembler-times "\[\t \]0xe000000\[\t \]+\[^\n\]*ctt_info" 2 } } */
+
+int b = 44;
+int * a = &b;
+
+struct foo_struct
+{
+  int bar_mem_1;
+  int bar_mem_2;
+  float d;
+  struct foo_struct *next;
+};
+
+struct foo_struct * node;
diff --git a/gcc/testsuite/gcc.dg/debug/ctf/ctf-skip-types-1.c b/gcc/testsuite/gcc.dg/debug/ctf/ctf-skip-types-1.c
new file mode 100644
index 0000000..a5c53f9
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/debug/ctf/ctf-skip-types-1.c
@@ -0,0 +1,33 @@
+/* CTF does not have representation for some types at this time.  These types
+   are skipped in the CTF generation phase in the compiler.
+   
+   This testcase does NOT cover all skipped types exhaustively.  */
+
+/* { dg-do compile } */
+/* { dg-options "-gt" } */
+
+#include <complex.h>
+
+typedef float La_x86_64_xmm __attribute__ ((__vector_size__ (16))); /* { dg-message "Skipping vector type as not represented in CTF" } */
+La_x86_64_xmm a1; /* { dg-message "Skipping vector type as not represented in CTF" } */
+
+/* GCC also supports complex integer data types.  */
+complex char a; /* { dg-message "Skipping complex integer type as not represented in CTF" } */
+complex signed char b; /* { dg-message "Skipping complex integer type as not represented in CTF" } */
+complex unsigned char c; /* { dg-message "Skipping complex integer type as not represented in CTF" } */
+complex short int d; /* { dg-message "Skipping complex integer type as not represented in CTF" } */
+complex short unsigned int e; /* { dg-message "Skipping complex integer type as not represented in CTF" } */
+complex int f; /* { dg-message "Skipping complex integer type as not represented in CTF" } */
+complex unsigned int g; /* { dg-message "Skipping complex integer type as not represented in CTF" } */
+complex long int h; /* { dg-message "Skipping complex integer type as not represented in CTF" } */
+complex long unsigned int i; /* { dg-message "Skipping complex integer type as not represented in CTF" } */
+complex long long int j; /* { dg-message "Skipping complex integer type as not represented in CTF" } */
+
+enum gomp_schedule_type
+{
+  GFS_RUNTIME,
+  GFS_STATIC,
+  GFS_MONOTONIC = 0x80000000U
+};
+
+enum gomp_schedule_type gsch_type; /* { dg-message "Skipping enumerator constant as not represented in CTF" } */
diff --git a/gcc/testsuite/gcc.dg/debug/ctf/ctf-str-table-1.c b/gcc/testsuite/gcc.dg/debug/ctf/ctf-str-table-1.c
new file mode 100644
index 0000000..2c5e352
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/debug/ctf/ctf-str-table-1.c
@@ -0,0 +1,26 @@
+/* CTF String Table as generated by the compiler is expected to have only a
+   single empty string.  Just an optimization by the compiler, it is not
+   mandated by the CTF format.  */
+
+/* { dg-do compile )  */
+/* { dg-options "-O0 -gt -dA" } */
+/* { dg-final { scan-assembler-times "ascii \".0\"\[\t \]+\[^\n\]*ctf_string" 1 } } */
+
+union wait
+{
+  int w_status;
+  struct
+    {
+      int __w_termsig;
+      int __w_coredump;
+    } __wait_terminated;
+   struct
+    {
+      int __w_stopval;
+      int __w_stopsig;
+    } __wait_stopped;
+};
+
+typedef union { union wait * __uptr; int * iptr; } __WAIT_STATUS;
+
+__WAIT_STATUS waitstatus;
diff --git a/gcc/testsuite/gcc.dg/debug/ctf/ctf-struct-1.c b/gcc/testsuite/gcc.dg/debug/ctf/ctf-struct-1.c
new file mode 100644
index 0000000..5d496d8
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/debug/ctf/ctf-struct-1.c
@@ -0,0 +1,25 @@
+/* Test compilation of struct type.
+
+   In this testcase, two CTF_K_STRUCT records are expected
+   struct a : ctt_info = 0x1a000004 (4 field members)
+   struct b : ctt_into = 0x1a000002 (2 field members)
+*/
+
+/* { dg-do compile )  */
+/* { dg-options "-O0 -gt -dA" } */
+
+/* { dg-final { scan-assembler-times "\[\t \]0x1a000004\[\t \]+\[^\n\]*ctt_info" 1 } } */
+/* { dg-final { scan-assembler-times "\[\t \]0x1a000002\[\t \]+\[^\n\]*ctt_info" 1 } } */
+/* { dg-final { scan-assembler-times "ctm_name" 6 } } */
+
+struct a
+{
+  int d1;
+  int d2;
+  float c;
+  struct b
+    {
+      int time;
+      int wall;
+    } b1;
+} my_a;
diff --git a/gcc/testsuite/gcc.dg/debug/ctf/ctf-struct-2.c b/gcc/testsuite/gcc.dg/debug/ctf/ctf-struct-2.c
new file mode 100644
index 0000000..5b9c9c1
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/debug/ctf/ctf-struct-2.c
@@ -0,0 +1,30 @@
+/* Test for compilation of self-referntial structs.
+
+   Further, the compiler is expected to generate a single CTF struct type for
+   struct dmx_dtdef (due to Type de-duplication at CTF generation).  */
+
+/* { dg-do compile )  */
+/* { dg-options "-O0 -gt -dA" } */
+/* { dg-final { scan-assembler-times "ascii \"dmx_dtdef.0\"\[\t \]+\[^\n\]*ctf_string" 1 } } */
+/* { dg-final { scan-assembler-times "ascii \"dtd_name.0\"\[\t \]+\[^\n\]*ctf_string" 1 } } */
+/* { dg-final { scan-assembler-times "ascii \"dtd_type.0\"\[\t \]+\[^\n\]*ctf_string" 1 } } */
+/* { dg-final { scan-assembler-times "ascii \"dmx_dtdef_t.0\"\[\t \]+\[^\n\]*ctf_string" 1 } } */
+
+struct link
+{
+  struct link * next;
+} * s_link;
+
+typedef long dmx_id_t;
+
+typedef struct dmx_dtdef
+{
+  char * dtd_name;
+  dmx_id_t dtd_type;
+} dmx_dtdef_t;
+
+typedef struct dmx_bundle
+{
+  dmx_id_t dmb_type;
+  dmx_dtdef_t * dmb_dtd;
+} dmx_bundle_t;
diff --git a/gcc/testsuite/gcc.dg/debug/ctf/ctf-struct-array-1.c b/gcc/testsuite/gcc.dg/debug/ctf/ctf-struct-array-1.c
new file mode 100644
index 0000000..552be47
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/debug/ctf/ctf-struct-array-1.c
@@ -0,0 +1,36 @@
+/* Test Compilation of mixed constructs containing structs and arrays.
+
+   Further, the compiler is expected to generate a single CTF struct type for
+   struct cmodel (due to Type de-duplication at CTF generation).
+   
+   const qualifiers in fields of structs should be processed.  It appears as a
+   no-name CTF record with appropriate ctt_info.  In this testcase, 2 const
+   qualifier records are expected - const char and const struct cmodel.  */
+
+/* { dg-do compile )  */
+/* { dg-options "-O0 -gt -dA" } */
+/* { dg-final { scan-assembler-times "ascii \"cmodel.0\"\[\t \]+\[^\n\]*ctf_string" 1 } } */
+/* { dg-final { scan-assembler-times "ascii \"cname.0\"\[\t \]+\[^\n\]*ctf_string" 1 } } */
+/* { dg-final { scan-assembler-times "ascii \"cpointer.0\"\[\t \]+\[^\n\]*ctf_string" 1 } } */
+/* { dg-final { scan-assembler-times "ascii \"cmodel_t.0\"\[\t \]+\[^\n\]*ctf_string" 1 } } */
+
+/* { dg-final { scan-assembler-times "\[\t \]0x32000000\[\t \]+\[^\n\]*ctt_info" 2 } } */
+
+struct a
+{
+  int a1[2];
+  struct { int b[3]; } a2;
+};
+
+typedef struct cmodel
+{
+  const char *cname;
+  int ccode;
+  int cpointer;
+} cmodel_t;
+
+static const cmodel_t _models[] = {
+  {"ILP32", 0, 4},
+  {"LP64", 0, 8},
+  {"", 0, 0}
+};
diff --git a/gcc/testsuite/gcc.dg/debug/ctf/ctf-typedef-1.c b/gcc/testsuite/gcc.dg/debug/ctf/ctf-typedef-1.c
new file mode 100644
index 0000000..227d7db
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/debug/ctf/ctf-typedef-1.c
@@ -0,0 +1,23 @@
+/* CTF_K_TYPEDEF record generation.
+
+   In this testcase, 7 typedef records are expected.  */
+
+/* { dg-do compile )  */
+/* { dg-options "-O0 -gt -dA" } */
+
+/* { dg-final { scan-assembler-times "0x2a000000\[\t \]+\[^\n\]*ctt_info" 7 } } */
+
+typedef int my_int;
+typedef int bar_int;
+typedef int foo_int;
+
+typedef struct { int a[2]; } my_array;
+
+typedef const int CINT;
+typedef const int * CINTP;
+
+typedef struct my_node
+{
+  int flags;
+  char value;
+} my_node_t;
diff --git a/gcc/testsuite/gcc.dg/debug/ctf/ctf-typedef-struct-1.c b/gcc/testsuite/gcc.dg/debug/ctf/ctf-typedef-struct-1.c
new file mode 100644
index 0000000..a7e5249
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/debug/ctf/ctf-typedef-struct-1.c
@@ -0,0 +1,12 @@
+/* { dg-do compile )  */
+/* { dg-options "-O0 -gt -dA" } */
+
+typedef struct my_int
+{
+  int upper;
+  int lower;
+  struct bitmask
+    {
+      int flags;
+    } my_mask;
+} my_int_t;
diff --git a/gcc/testsuite/gcc.dg/debug/ctf/ctf-union-1.c b/gcc/testsuite/gcc.dg/debug/ctf/ctf-union-1.c
new file mode 100644
index 0000000..59b4cb7
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/debug/ctf/ctf-union-1.c
@@ -0,0 +1,14 @@
+/* CTF generation for union type.  */
+
+/* { dg-do compile )  */
+/* { dg-options "-O0 -gt -dA" } */
+/* { dg-final { scan-assembler-times "\[\t \]0x1e000004\[\t \]+\[^\n\]*ctt_info" 1 } } */
+/* { dg-final { scan-assembler-times "ctm_name" 4 } } */
+
+union c
+{
+  int c1;
+  int c2;
+  int c3;
+  int c4;
+} my_u_c;
diff --git a/gcc/testsuite/gcc.dg/debug/ctf/ctf-variables-1.c b/gcc/testsuite/gcc.dg/debug/ctf/ctf-variables-1.c
new file mode 100644
index 0000000..a2e2557
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/debug/ctf/ctf-variables-1.c
@@ -0,0 +1,25 @@
+/* CTF generation for global variables.
+
+   In this testcase, 7 records in the variable info section are expected.  */
+
+/* { dg-do compile )  */
+/* { dg-options "-O0 -gt -dA" } */
+
+/* { dg-final { scan-assembler-times "ctv_name" 7 } } */
+
+float var1;
+double var2;
+long double var3;
+
+char ascii = 'a';
+
+int a = 33;
+int a1[2] = {22, 33};
+
+struct d
+{
+  int d1;
+  int d2;
+};
+
+struct d d_instance;
