diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 24e47d4..adf2b8b 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,9 @@
+2013-07-24  Evgeny Gavrin <e.gavrin@samsung.com>
+  * gcc/dwarf2out.c (should_emit_struct_debug): Add check
+  for type_decl variable is not NULL.
+  * testuite/gcc.dg/debug/dwarf2/omp-fesdr.c: Add test.
+  * testuite/g++.dg/debug/dwarf2/omp-fesdr.C: Add test.
+
 2013-07-23  Bill Schmidt  <wschmidt@linux.vnet.ibm.com>
 	    Anton Blanchard <anton@au1.ibm.com>
 
diff --git a/gcc/dwarf2out.c b/gcc/dwarf2out.c
index 87f9644..ee007bd 100644
--- a/gcc/dwarf2out.c
+++ b/gcc/dwarf2out.c
@@ -365,11 +365,15 @@ should_emit_struct_debug (tree type, enum debug_info_usage usage)
 
   type_decl = TYPE_STUB_DECL (TYPE_MAIN_VARIANT (type));
 
-  if (criterion == DINFO_STRUCT_FILE_SYS && DECL_IN_SYSTEM_HEADER (type_decl))
-    return DUMP_GSTRUCT (type, usage, criterion, generic, false, true);
+  if (type_decl != NULL)
+    {
+     if (criterion == DINFO_STRUCT_FILE_SYS && DECL_IN_SYSTEM_HEADER (type_decl))
+        return DUMP_GSTRUCT (type, usage, criterion, generic, false, true);
+
+      if (matches_main_base (DECL_SOURCE_FILE (type_decl)))
+        return DUMP_GSTRUCT (type, usage, criterion, generic, true, true);
+    }
 
-  if (matches_main_base (DECL_SOURCE_FILE (type_decl)))
-    return DUMP_GSTRUCT (type, usage, criterion, generic, true, true);
   return DUMP_GSTRUCT (type, usage, criterion, generic, false, false);
 }
 
diff --git a/gcc/testsuite/g++.dg/debug/dwarf2/omp-fesdr.C b/gcc/testsuite/g++.dg/debug/dwarf2/omp-fesdr.C
new file mode 100644
index 0000000..005acdf
--- /dev/null
+++ b/gcc/testsuite/g++.dg/debug/dwarf2/omp-fesdr.C
@@ -0,0 +1,35 @@
+/* { dg-do compile } */
+/* { dg-options "-g -fopenmp -gdwarf-2 -femit-struct-debug-reduced" } */
+
+struct aa
+{
+  int a;
+};
+
+int
+f7 (void)
+{
+  int v7i = 6, v7j = 7, v7k = 9, v7l = 0, v7n = 0, v7o = 1;
+
+  #pragma omp parallel
+  {
+    #pragma omp master
+    v7o++;
+    #pragma omp for private (v7i) firstprivate (v7k) reduction (+:v7l)
+    for (v7n = 0; v7n < 3; v7n++)
+    {
+      int v7m = v7j + v7k;
+      v7i = 8;
+      v7l++;
+    }
+  }
+
+  return v7i + v7j + v7k + v7l + v7n;
+}
+
+int
+main (void)
+{
+  f7 ();
+  return 0;
+}
diff --git a/gcc/testsuite/gcc.dg/debug/dwarf2/omp-fesdr.c b/gcc/testsuite/gcc.dg/debug/dwarf2/omp-fesdr.c
new file mode 100644
index 0000000..005acdf
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/debug/dwarf2/omp-fesdr.c
@@ -0,0 +1,35 @@
+/* { dg-do compile } */
+/* { dg-options "-g -fopenmp -gdwarf-2 -femit-struct-debug-reduced" } */
+
+struct aa
+{
+  int a;
+};
+
+int
+f7 (void)
+{
+  int v7i = 6, v7j = 7, v7k = 9, v7l = 0, v7n = 0, v7o = 1;
+
+  #pragma omp parallel
+  {
+    #pragma omp master
+    v7o++;
+    #pragma omp for private (v7i) firstprivate (v7k) reduction (+:v7l)
+    for (v7n = 0; v7n < 3; v7n++)
+    {
+      int v7m = v7j + v7k;
+      v7i = 8;
+      v7l++;
+    }
+  }
+
+  return v7i + v7j + v7k + v7l + v7n;
+}
+
+int
+main (void)
+{
+  f7 ();
+  return 0;
+}
