aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBrian Drummond <brian@shapes.demon.co.uk>2013-12-08 18:53:25 +0000
committerBrian Drummond <brian@shapes.demon.co.uk>2013-12-08 18:53:25 +0000
commit922c6333d93cf59261d9beab603b2ac5e2e19319 (patch)
tree90f7fbe48a8771f03b8e10506948b0856f9bcb29
parent04b041be9062db340a648f5ed0f0788ac25c7290 (diff)
downloadghdl-922c6333d93cf59261d9beab603b2ac5e2e19319.tar.gz
ghdl-922c6333d93cf59261d9beab603b2ac5e2e19319.tar.bz2
ghdl-922c6333d93cf59261d9beab603b2ac5e2e19319.zip
Patch to eliminate compile failures outputting debug information when -g -O2 options are set
-rw-r--r--.gdbinit68
-rw-r--r--ortho/gcc/ortho-lang.c49
2 files changed, 14 insertions, 103 deletions
diff --git a/.gdbinit b/.gdbinit
deleted file mode 100644
index 950f8d954..000000000
--- a/.gdbinit
+++ /dev/null
@@ -1,68 +0,0 @@
-#break __gnat_raise
-#break ada__exceptions__raise_exception
-break __gnat_raise_nodefer_with_msg
-
-define pt
-call disp_tree.disp_tree ($arg0, 0, 0)
-end
-
-document pt
-Print the structure of the iirs that is $arg0.
-end
-
-define prt
-set lang c
-print (iirs__iir *) $
-set lang ada
-end
-
-define pl
-call disp_tree_list ($arg0, 0, 0)
-end
-
-document pl
-Print the list of iirs that is $arg0.
-end
-
-define plf
-call disp_tree_list ($arg0, 0, 1)
-end
-
-document plf
-Print flatly the list of iirs that is $arg0.
-end
-
-define ptf
-call disp_tree_flat ($arg0, 0)
-end
-
-document ptf
-Print the iirs that is $arg0.
-end
-
-define ptf1
-call disp_tree ($, 0, 1)
-end
-
-document ptf1
-Print the iirs that is $.
-end
-
-define pv
-call disp_value ($)
-end
-
-document pv
-Print the value that is $.
-end
-
-define ploc
-call disp_iir_location ($arg0.all)
-end
-
-document ploc
-Print the location for iir_acc $.
-end
-
-set lang ada
-#break exception
diff --git a/ortho/gcc/ortho-lang.c b/ortho/gcc/ortho-lang.c
index 904bfa46d..f5cb2bd15 100644
--- a/ortho/gcc/ortho-lang.c
+++ b/ortho/gcc/ortho-lang.c
@@ -24,7 +24,7 @@
#include "tree-dump.h"
// temp for debugging
-// #include "stdio.h"
+#include "stdio.h"
/* TODO:
* remove stmt_list_stack, save in if/case/loop block
@@ -235,7 +235,9 @@ global_bindings_p (void)
static tree
pushdecl (tree t)
{
- gcc_unreachable ();
+ //gcc_unreachable ();
+ // gcc4.8.2 we get here from build_common_builtin_nodes () call in ortho_init
+ return t;
}
static tree
@@ -309,39 +311,6 @@ ortho_init (void)
("__builtin_stack_restore", ftype_ptr,
BUILT_IN_STACK_RESTORE, BUILT_IN_NORMAL, NULL, NULL_TREE), true);
}
-
- /* Test and (if necessary) repair BUILT_IN_UNREACHABLE builtin.
- FIXME: Re-evaluate this and remove when upstream gcc has fixed the
- underlying problem : gcc4.8.2 segfaults compiling with -O2,
- during fn "void unloop_loops" in tree-ssa-loop-ivcanon.c */
- {
- tree func_type = build_function_type (ptr_type_node, NULL_TREE);
-
- if (builtin_decl_implicit_p (BUILT_IN_UNREACHABLE))
- {
- // printf("BUILT_IN_UNREACHABLE function is available\n");
- }
- else
- {
- tree builtin_f = builtin_decl_explicit (BUILT_IN_UNREACHABLE);
- // printf("No implicit BUILT_IN_UNREACHABLE function : repairing!\n");
- debug_tree(builtin_f);
- if (builtin_f == NULL_TREE)
- {
- // printf("Adding BUILT_IN_UNREACHABLE function\n");
- set_builtin_decl (BUILT_IN_UNREACHABLE,
- builtin_function("__builtin_unreachable", func_type,
- BUILT_IN_UNREACHABLE, BUILT_IN_NORMAL, NULL, NULL_TREE),
- true);
- }
- else
- {
- // printf("Making BUILT_IN_UNREACHABLE function implicit\n");
- set_builtin_decl_implicit_p (BUILT_IN_UNREACHABLE, true);
- }
- }
- }
-
{
REAL_VALUE_TYPE v;
@@ -356,6 +325,10 @@ ortho_init (void)
ortho_fe_init ();
+ build_common_builtin_nodes ();
+ // FIXME: this MAY remove the need for creating the builtins above...
+ // Evaluate tree.c / build_common_builtin_nodes (); for each in turn.
+
return true;
}
@@ -379,6 +352,12 @@ ortho_post_options (const char **pfilename)
/* Default hook. */
lhd_post_options (pfilename);
+ // This stops compile failures writing debug information when both -g and -O2
+ // (or -O1, -O3 or -Os) options are present.
+ // Should really make it conditional on specific options
+ // FIXME : re-evaluate if this is still necessary with newer gccrevisions
+ dwarf_strict = 1;
+
/* Run the back-end. */
return false;
}